Welcome to the classic Snake Game implemented in C++! This game is a fun and simple way to pass time where you control a growing snake that navigates around the screen.
The Snake Game is a classic computer game that originated during the late 1970s. The player controls a dot, square, or object on a bordered plane or box. As it moves forward, it leaves a trail behind, resembling a moving snake. The concept originated in the arcade game Blockade, and the ease of implementing Snake has led to hundreds of versions for many platforms.
In this game, the player controls a snake that consumes apples, which makes the snake longer. The game ends when the snake either moves off the screen or moves into itself. The goal is to consume as many apples as possible before the game ends.
Use the arrow keys to navigate the snake. The snake will grow each time it eats an apple. The game ends when the snake hits the screen border or when it hits its own body. Implementation Details 💻 The game is implemented using standard C++ libraries. The snake is represented as a deque of coordinates on the game grid. The game runs in a continuous loop where the state of the game is updated and the screen is redrawn.
Installation and Running 🛠️ To play the game, clone the repository, navigate to the directory containing snake_game.cpp, compile and run the file.
g++ main.cpp -o snake_game ./snake_game
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License.
Enjoy the game and have fun! 🎉🎉🎉