This is a classic command-line snake game I made when I first learned C++, with multiple difficulty modes and wall-piercing gameplay
-
Movement
W/โ: Move Up
S/โ: Move Down
A/โ: Move Left
D/โ: Move Right -
Menu Navigation
โ/โ: Select Difficulty
Enter: Confirm and Start
-
Three Difficulty Modes
๐ข Easy Mode - Slow movement, wall-passing enabled
๐ Normal Mode - Medium speed, wall-passing enabled
๐ด Hard Mode - Fast movement, wall collision ends game -
Smart Food Generation
- Food (
F) always spawns in valid positions - Automatically avoids snake body and walls
- Aligns with snake movement step (Y coordinate is even)
- Food (
-
Game Rules
โ Eat food to grow (+1 point per food)
โ Game ends if snake collides with itself
โ Wall collision immediately ends game in Hard Mode
-
Requirements
- Windows OS
- C++17 compatible compiler
-
Compile & Run
g++ main.cpp FigureEngine.cpp -o snake.exe -std=c++17 ./snake.exe
Ensure console window size is at least 40x20 characters
Game Symbols: '#' - Wall | 'O' - Snake Body | 'F' - Food
Close the window to exit the game
๐ฎ Start your snake adventure! See how long you can survive in Hard Mode!