Skip to content

Yes the one you're thinking of... Terminal-based Snake game written in C with full dynamic memory management and collision logic.

License

Notifications You must be signed in to change notification settings

Nullskulls/CLISnakeGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLISnakeGame

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.

Features

  • 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

Controls

  • W - Move up
  • A - Move left
  • S - Move down
  • D - Move right
  • ESC - Exit game

Requirements

  • A C compiler (e.g., GCC or Clang)
  • Windows terminal or MinGW (due to Windows-specific functions like getch() and Sleep())

Build Instructions

mkdir build
cd build
cmake ..
make

Run the Game

./CLISnakeGame

Project Structure

.
├── Source/
│   ├── Draw.c / .h
│   ├── Edit_Board.c / .h
│   ├── game.c / .h
│   └── main.c
├── CMakeLists.txt
├── LICENSE
└── README.md

Acknowledgements

Built from scratch as a first personal project in C. Expect bugs, memory leaks (hopefully fewer now), and chaos. Feedback is welcome.

About

Yes the one you're thinking of... Terminal-based Snake game written in C with full dynamic memory management and collision logic.

Resources

License

Stars

Watchers

Forks