Skip to content

Show Game Over when the snake crashes - #145

Open
amamsy90 wants to merge 1 commit into
grantjenks:masterfrom
amamsy90:fix-snake-game-over
Open

amamsy90 wants to merge 1 commit into
grantjenks:masterfrom
amamsy90:fix-snake-game-over

Conversation

@amamsy90

@amamsy90 amamsy90 commented Oct 4, 2026 •

Copy link
Copy Markdown

Summary

  • Fixes Missing end-of-game experience #132. After the snake hit a wall or itself, the window froze on a red square and never said the game was over.
  • Draw a centered red Game Over message, then stop the loop the same way as before.

Test plan

  • Reproduced the bug with the existing mocked turtle run (random.seed(0) plus the arrow-key sequence in tests/test_snake.py). The snake grew (Snake: 2) and no text was drawn.
  • After the change, pytest tests/test_snake.py passes and snake.py stays at 100% coverage. The test asserts that Game Over is written.
  • pytest tests: 45 passed.
  • Play python -m freegames.snake, crash into a wall, and confirm the message appears in the window.

The window froze on a red square after a wall or self hit, with no sign that the game had ended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing end-of-game experience

1 participant