MIL-003: Continuous play and high score #37

Merged
Tirsvad merged 7 commits from mil-003-continuous-play-and-high-score into main 2026-10-13 08:35:54 +02:00
Owner

Delivers MIL-003 (RC-006, code review RC-011; autonomous mode, not independent).

Closes #16
Closes #17
Closes #18
Closes #19
Closes #20
Closes #21
Closes #22

Changes from MIL-002

  • constants.py: GAME_OVER_TEXT and GAME_OVER_POSITION removed; HIGH_SCORE_LABEL and SEGMENT_PARKING_POSITION added.
  • Scoreboard: high_score attribute (0 until MIL-004), text Score: <score> High Score: <high_score>, reset() replaces game_over().
  • Snake.reset(): old segments sent to (1000, 1000), list emptied, snake created again, head and the direction of travel renewed.
  • main.py: end_game_if_over is replaced by reset_if_collision; the loop never ends by itself, exitonclick is gone, closing the window still ends quietly.
  • Tests: game-over tests replaced by reset tests; 138 -> 149 tests.

Checks run locally (fresh .venv)

  • pytest: 149 passed, no window opened
  • ruff check and ruff format --check: clean; mypy strict: clean; doxygen: 0 warnings
  • python -m snake_game: smoke run, still running after 4 seconds

Hitting the wall and the tail by hand in the real window is S01's check of Go/No-Go criterion 10; the behaviour is covered by the tests above.

Delivers MIL-003 (RC-006, code review RC-011; autonomous mode, not independent). Closes #16 Closes #17 Closes #18 Closes #19 Closes #20 Closes #21 Closes #22 ## Changes from MIL-002 - `constants.py`: `GAME_OVER_TEXT` and `GAME_OVER_POSITION` removed; `HIGH_SCORE_LABEL` and `SEGMENT_PARKING_POSITION` added. - `Scoreboard`: `high_score` attribute (0 until MIL-004), text `Score: <score> High Score: <high_score>`, `reset()` replaces `game_over()`. - `Snake.reset()`: old segments sent to (1000, 1000), list emptied, snake created again, `head` and the direction of travel renewed. - `main.py`: `end_game_if_over` is replaced by `reset_if_collision`; the loop never ends by itself, `exitonclick` is gone, closing the window still ends quietly. - Tests: game-over tests replaced by reset tests; 138 -> 149 tests. ## Checks run locally (fresh .venv) - pytest: 149 passed, no window opened - ruff check and ruff format --check: clean; mypy strict: clean; doxygen: 0 warnings - `python -m snake_game`: smoke run, still running after 4 seconds Hitting the wall and the tail by hand in the real window is S01's check of Go/No-Go criterion 10; the behaviour is covered by the tests above.
Tirsvad added 7 commits 2026-10-13 08:34:16 +02:00
Refs #16
Task: MIL-003#1
Refs #17
Refs #18
Task: MIL-003#2
Task: MIL-003#3
Refs #19
Task: MIL-003#4
Refs #20
Task: MIL-003#5
Refs #21
Task: MIL-003#6
Resolve pending commit links
CI / checks (push) Successful in 44s
CI / checks (pull_request) Successful in 47s
12a64d4913
Tirsvad merged commit b4d99e7e01 into main 2026-10-13 08:35:54 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Tirsvad-Udemy-100-days-of-code/024-snake#37