Team Members: Mrunali Parmar - 202401122 Manya Rana - 202401115 Maharshi Soni - 202401108
A classic Snake Game built in C++ using the Windows Console API. The game includes boundary detection, self-collision detection, and a score system.
- Use W, A, S, D keys to control the snake:
Wโ Move UpAโ Move LeftSโ Move DownDโ Move Right
x-> Ends the game- Eat the food (
o) to grow the snake. - Avoid hitting the walls or your own bodyโotherwise, it's Game Over!
โ๏ธ Boundary Handling: The game ends if the snake hits the wall.
โ๏ธ Self-Collision Detection: If the snake runs into itself, the game ends.
โ๏ธ Random Food Placement: Food spawns at random positions within the console.
โ๏ธ Score System: The score increases each time the snake eats food.
โ๏ธ Smooth Movement: Uses the Sleep(100) function to control movement speed.
โ๏ธ Real-Time Input Handling: Uses _kbhit() to capture user input without waiting.
- Clone this repository
git clone https://github.com/your-username/snake-game.git cd snake-game - Compile the code using g++ (MinGW recommended)
g++ snake.cpp -o snake.exe
- Run the game
./snake.exe
- Operating System: Windows (due to
windows.hdependency) - Compiler: MinGW (g++) or MSVC
(You can add an image here by uploading it to your repository and linking it)
Add pause and resume functionality.
Add difficulty levels (speed increase over time).
Support for Linux & macOS (replace windows.h with cross-platform alternatives).
Implement a high score system to track and display the best score across multiple game sessions.
