Commit Graph
5 Commits
Author SHA1 Message Date
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 6f196f0f79 Adopt constants.py and its test
Copied from the base with identity-only edits: the docstrings name days 20 and 21, and the package main page describes the whole game. The values are unchanged; MIL-003 checks them against the day-21 lectures.

Task: MIL-001#3
Closes #3
2026-10-08 17:46:40 +08:00