A classic Tetris game implementation written in C with colorful terminal graphics and sound effects.
- ๐ฎ Classic Tetris gameplay with 6 different tetromino shapes
- ๐จ Colorful terminal graphics with ANSI color codes
- ๐ Sound effects for moves and line clears
- ๐ Score tracking system
- ๐ฏ Smooth falling mechanics with customizable speed
| Key | Action |
|---|---|
A |
Move piece left |
D |
Move piece right |
S |
Move piece down (soft drop) |
Space |
Rotate piece |
Enter |
Start game / Continue |
-
Compile the game (if you don't have the executable):
gcc main.cpp config.h shape.h -o ctetris
-
Run the game:
./ctetris # or on Windows: main.exe -
Gameplay:
- Tetromino pieces fall from the top of the playing field
- Use the controls to move and rotate pieces
- Complete horizontal lines to clear them and earn points
- Game ends when pieces reach the top of the playing field
- Each line cleared awards 500 points
- Try to achieve the highest score possible!
- Windows: Uses
conio.handwindows.hfor input handling and sound - Compiler: Compatible with GCC, Clang, or MSVC
- Terminal: ANSI color support recommended for best visual experience
c-tetris/
โโโ main.cpp # Main game logic and loop
โโโ config.h # Color definitions and utility functions
โโโ shape.h # Tetromino shape definitions
โโโ main.exe # Compiled executable (Windows)
โโโ README.md # This file
- Grid Size: 18x18 playing field
- Shapes: 6 unique tetromino types with 4 rotation states each
- Frame Rate: 30 frames per move cycle
- Platform: Windows (uses Windows-specific libraries)
To compile the game from source:
gcc main.cpp config.h shape.h -o ctetris -std=c99Note: This game is designed for Windows systems and uses Windows-specific libraries (conio.h, windows.h). For other platforms, you may need to modify the input handling and sound functions.
Feel free to submit issues, feature requests, or pull requests to improve the game!
This project is open source. Feel free to use and modify as needed.
