Skip to content

Mru1726/Data-Trio---Project-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

24 Commits
ย 
ย 
ย 
ย 

Repository files navigation

Team Members: Mrunali Parmar - 202401122 Manya Rana - 202401115 Maharshi Soni - 202401108

Snake Game (C++ Console Application) ๐Ÿ

A classic Snake Game built in C++ using the Windows Console API. The game includes boundary detection, self-collision detection, and a score system.

๐Ÿ“œ How to Play

  • Use W, A, S, D keys to control the snake:
    • W โ†’ Move Up
    • A โ†’ Move Left
    • S โ†’ Move Down
    • D โ†’ 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!

โš™๏ธ Features

โœ”๏ธ 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.

๐Ÿ“ฅ Installation & Setup

  1. Clone this repository
    git clone https://github.com/your-username/snake-game.git
    cd snake-game
  2. Compile the code using g++ (MinGW recommended)
    g++ snake.cpp -o snake.exe
  3. Run the game
    ./snake.exe

๐Ÿ–ฅ๏ธ System Requirements

  • Operating System: Windows (due to windows.h dependency)
  • Compiler: MinGW (g++) or MSVC

๐Ÿ“ธ Screenshot

(You can add an image here by uploading it to your repository and linking it)

Snake Game in C++

Snake Game

๐Ÿ› ๏ธ Future Improvements

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.


Enjoy the game!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages