MIL-002: Adopt the game #24

Merged
Tirsvad merged 8 commits from mil-002-adopt-the-game into main 2026-10-08 12:38:27 +02:00
8 Commits
Author SHA1 Message Date
Tirsvad efd0c7fc00 Resolve pending commit links
CI / checks (push) Successful in 47s
CI / checks (pull_request) Successful in 44s
Replaces pending in the Version History of RC-008 with a link to the commit that introduced the row.
2026-10-08 18:31:25 +08:00
Tirsvad 0d3b91321d Record the review of the MIL-002 code (RC-008)
Python code reviewed against QC-PY-001 with the verdict Go. Task 7 stays open: the manual play of criterion 5 is S01's.

Task: MIL-002#7
Refs #14
2026-10-08 18:31:08 +08:00
Tirsvad 38138656a1 Describe the adopted game in the README
The Status, Run and Project layout sections now describe python -m snake_game, the keys, the food, the score and the game-over rules, taken from the base README. MIL-003 finishes the README for the whole game.

Task: MIL-002#6
Closes #13
2026-10-08 18:31:07 +08:00
Tirsvad 6b0ee0cc0d Adopt the main flow and the entry point
Copied unchanged from the base: screen set-up, key bindings, the animation loop with game_is_on, the eating check, the game-over check, the wait for a click and the quiet exit when the window is closed. main imports food and scoreboard only when it runs, so importing it needs neither turtle nor tkinter.

Task: MIL-002#5
Closes #12
2026-10-08 18:31:06 +08:00
Tirsvad ca65ba7830 Adopt the Scoreboard class and its tests
Copied unchanged from the base: class Scoreboard(Turtle) with update_scoreboard, increase_score and game_over. MIL-003 checks the values against the day-21 lectures.

Task: MIL-002#4
Closes #11
2026-10-08 18:31:05 +08:00
Tirsvad ab92d5871c Adopt the Food class and its tests
Copied unchanged from the base: class Food(Turtle) with refresh, and one random_coordinate function that the tests replace. MIL-003 checks the values against the day-21 lectures.

Task: MIL-002#3
Closes #10
2026-10-08 18:31:04 +08:00
Tirsvad 73fdc2026f Adopt the Snake class and its tests
Copied unchanged from the base: create_snake, add_segment, extend, move, hits_wall, hits_tail, up, down, left and right, with the segments list and the head. The tail check loops over the slice segments[1:]. snake.py does not import turtle until a real segment is made.

Task: MIL-002#2
Closes #9
2026-10-08 18:31:03 +08:00
Tirsvad 5575658503 Adopt the test fakes
Copied unchanged from the base (020-snake-game, commit 1a638c9): the fake segment, the fake screen and the fake Turtle base class that record their calls, so every test runs without a display. The fake turtle module is installed with monkeypatch, so it is undone after each test.

Task: MIL-002#1
Closes #8
2026-10-08 18:31:01 +08:00