A terminal-based implementation of the classic Snake game written in C. This is a beginner-friendly project focused on mastering memory management, pointers, and dynamic 2D arrays in a command-line interface.
- Fully playable Snake game in the terminal
- Dynamic memory handling for board, snake position, and apple placement
- Collision detection (walls and self)
- Snake growth on apple consumption
- Apple respawning system with ratio logic
- Custom board drawing and frame refreshing
- Memory cleanup on exit
W- Move upA- Move leftS- Move downD- Move rightESC- Exit game
- A C compiler (e.g., GCC or Clang)
- Windows terminal or MinGW (due to Windows-specific functions like
getch()andSleep())
mkdir build
cd build
cmake ..
make./CLISnakeGame.
├── Source/
│ ├── Draw.c / .h
│ ├── Edit_Board.c / .h
│ ├── game.c / .h
│ └── main.c
├── CMakeLists.txt
├── LICENSE
└── README.md
Built from scratch as a first personal project in C. Expect bugs, memory leaks (hopefully fewer now), and chaos. Feedback is welcome.