MIL-003: Check against day 21 #25

Merged
Tirsvad merged 1 commits from mil-003-check-against-day-21 into main 2026-10-08 12:49:43 +02:00
+15 -4
View File
@@ -17,10 +17,10 @@ This repository continues
[020-snake-game](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/020-snake-game) [020-snake-game](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/020-snake-game)
and starts from its finished game; `docs/project-plan.md` tells how the work is split. and starts from its finished game; `docs/project-plan.md` tells how the work is split.
> **Status:** the game is in the repository: `python -m snake_game` plays the whole > **Status:** the game is finished: the snake moves by itself, is steered with the
> game, adopted from the finished game of 020 together with its tests. The next > arrow keys, eats food and grows, the score is shown, and the game is over at the
> milestone, `MIL-003`, checks it against the day-21 lectures and finishes this > wall or at the tail. It was adopted from the finished game of 020 and checked
> README. > against the day-21 lectures; see `docs/project-plan.md`.
## Requirements ## Requirements
@@ -169,6 +169,17 @@ The HTML is written to `build/doxygen/index.html`. A warning fails the build.
└── README.md └── README.md
``` ```
Where the day-21 lessons are in the code, so that you can compare it with your own
solution:
| Day-21 lecture | Where it is |
| --- | --- |
| Class inheritance | `Food(Turtle)` in `food.py` and `Scoreboard(Turtle)` in `scoreboard.py` |
| Collisions with the food | `Food.refresh`, `eat_food_if_close` in `main.py`, `FOOD_*` in `constants.py` |
| The scoreboard | `Scoreboard.update_scoreboard` and `Scoreboard.increase_score` |
| The wall | `Snake.hits_wall`, `WALL_LIMIT`, and `Scoreboard.game_over` for the text |
| The tail and slicing | `Snake.extend`, `Snake.add_segment` and `Snake.hits_tail`, which loops over `segments[1:]` |
## License ## License
GNU Affero General Public License v3.0 only. See [LICENSE](LICENSE). GNU Affero General Public License v3.0 only. See [LICENSE](LICENSE).