turtle module. The snake moves around a 650×650 black canvas, eating red circular food to grow longer and accumulate points. The game ends — and automatically resets — when the snake collides with a wall or its own body.
This project was created by Franklin Camacho (@CamachoFranklin) as a Programación III university project (2021-II semester) at Universidad Centroccidental “Lisandro Alvarado”.
Technologies used
The game runs entirely on the Python standard library — no third-party packages required.| Module | Purpose |
|---|---|
turtle | Renders the canvas, snake, food, and score text |
time | Controls the game loop delay and the post-collision pause |
random | Places food at random coordinates within the playfield |
How the game works
- The snake starts at the center of the 650×650 black canvas
- Use the arrow keys to steer the snake up, down, left, or right
- Each red circular food item the snake eats adds one body segment and increments the score
- The snake cannot reverse direction — pressing the opposite key has no effect
- Hitting a wall or the snake’s own body ends the round; the game resets automatically after a short pause
- The highest score reached during the session is preserved across resets
The snake moves in 20-pixel increments per frame, and each body segment is represented as a green square Turtle shape.
Prerequisites
The only requirement to run Snake Game Python is a working Python installation. Theturtle, time, and random modules all ship with the Python standard library.
Download Python from python.org/downloads. Python 3 is recommended.
Next steps
Quickstart
Run the game in a few commands — no pip install needed.
How it works
Understand the game loop, Turtle graphics, and collision detection.
