🎮 Snake Game
This classic Snake Game brings back nostalgic gameplay in a modern Python environment using Pygame. Built and tested on Ubuntu via WSL, this project also leverages Amazon Q CLI to streamline development, debug faster, and manage Python packages directly in the terminal — making the entire process smoother and more efficient.
Players control a growing snake that must eat red food to gain points and grow longer, while avoiding collisions with walls and its own body. As the game progresses, the challenge increases, offering an engaging experience through simple yet addictive mechanics.
🚀 Why Amazon Q CLI?
By using Amazon Q CLI, you can:
- Get instant coding assistance for Python logic
- Debug runtime errors in real time
- Automate virtual environment setup and dependency management
- Ask technical questions while coding — all directly in the CLI
Amazon Q CLI made it easier for me to stay focused and productive during the entire dev process.
🎮 How to Play
- Run the game:
python3 snake_game.py
- Controls:
- ↑ Up arrow: Move up
- ↓ Down arrow: Move down
- ← Left arrow: Move left
- → Right arrow: Move right
- Objective:
- Eat red food to grow and increase your score
- Avoid hitting the walls or your own body
- After Game Over:
- Press
Q
to quit - Press
C
to play again
- Press
🔥 Game Features
- Real-time score tracking
- Increasing difficulty as the snake grows
- Game Over screen with restart option
- Smooth controls and collision detection
💻 Requirements
- Python 3
- Pygame library
- WSL (Ubuntu 22.04 recommended)
- Amazon Q CLI (optional but highly recommended)
📦 Installation Steps
- Ensure Python 3 is installed:
python3 --version
- Install Pygame:
pip install pygame
Clone or download this project.
Run the game:
python3 snake_game.py
- (Optional) Use Amazon Q CLI:
q help
🧠 Code Structure
-
snake_game.py
- Game window setup
- Snake movement and logic
- Food generation
- Collision detection
- Score tracking
- Game restart/quit logic
🌱 Future Improvements
- Add sound effects
- Introduce multiple difficulty levels
- Save and display high scores
- Add obstacles or maze elements
- Add power-ups for special abilities
📸 Screenshot
(Bạn có thể chèn ảnh minh họa game tại đây)

🪪 License
This project is open-source and free to use, modify, and improve!
Top comments (0)