A simple, classic Snake game that you can play directly in your Mac Terminal! This project was developed to practice Python and bring the classic Snake game to life in a text-based format.
In this version of Snake, you control a snake to eat as much food as possible and grow longer. Avoid hitting the walls or the snake’s own tail, or the game will end.
- Use the arrow keys to control the snake's direction.
- Your goal is to "eat" the food items that appear randomly on the screen to make the snake grow longer.
- Be careful not to collide with the walls or the snake's own body, or it's game over!
Most Macs come with Python pre-installed. To check if Python is installed:
-
Open the Terminal app (you can find it in Applications > Utilities).
-
Type the following command and press Enter:
python3 --version
-
If you see a version number like Python 3.x.x, you’re ready to go! If you see an error, download Python from https://www.python.org/downloads/ and follow the installation instructions.
Step 2: Download the Snake Game Code
1. Go to this GitHub repository and download the game files:
• Click the green Code button at the top of this page.
• Select Download ZIP.
2. Unzip the downloaded file. You should see a folder named something like snake-game-terminal-main.
Step 3: Run the Game
1. Open the Terminal app again.
2. In the Terminal, type cd (with a space after cd).
3. Drag the unzipped folder (e.g., snake-game-terminal-main) from Finder into the Terminal window to automatically insert the path.
4. Press Enter to navigate to the game folder.
5. Run the following command to start the game:python3 snake.py
6. Use the arrow keys to play. Try to eat the food and avoid crashing into the walls or yourself!
Step 4: Quit the Game
To quit the game at any time, simply close the Terminal window or press Ctrl + C in the Terminal.
Known Issues:
• The game may not run properly on Windows due to differences in terminal handling. This version is specifically designed for macOS.
• If you encounter any issues or have suggestions, please feel free to open an issue on GitHub.
Enjoy the game! Feel free to share your feedback or improvements.