Skip to content

A classic command-line snake game with multiple difficulty modes and wall-passing gameplay.

Notifications You must be signed in to change notification settings

yuanmao1/ConsoleSnake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Snake Game

This is a classic command-line snake game I made when I first learned C++, with multiple difficulty modes and wall-piercing gameplay

๐Ÿ•น๏ธ Controls

  • Movement
    W/โ†‘ : Move Up
    S/โ†“ : Move Down
    A/โ† : Move Left
    D/โ†’ : Move Right

  • Menu Navigation
    โ†‘/โ†“ : Select Difficulty
    Enter : Confirm and Start

๐ŸŒŸ Features

  • 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)
  • 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

๐Ÿ“ฅ Installation & Running

  1. Requirements

    • Windows OS
    • C++17 compatible compiler
  2. Compile & Run

    g++ main.cpp FigureEngine.cpp -o snake.exe -std=c++17
    ./snake.exe

๐Ÿ“Œ Notes

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!

About

A classic command-line snake game with multiple difficulty modes and wall-passing gameplay.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages