Describe the adopted game in the README

Refs #14
Task: MIL-002#6
This commit is contained in:
2026-10-13 14:21:04 +08:00
parent b34f66e892
commit ae30705496
+33 -13
View File
@@ -19,11 +19,11 @@ This repository continues
and starts from its finished game; `docs/project-plan.md` tells how the work is and starts from its finished game; `docs/project-plan.md` tells how the work is
split into milestones. split into milestones.
> **Status:** in progress. The repository foundation (this README, the > **Status:** in progress. The finished game of day 21 is adopted and runs: the
> configuration, the constants, the Doxygen settings and the continuous > snake moves, eats and grows, the score is shown and the game ends at the wall
> integration workflow) is in place; the game itself, continuous play, the high > or at the tail. Continuous play and the high score (milestone 3), the high
> score and the high score file follow in milestones 2 to 4, and the wiki in > score file (milestone 4) and the wiki (milestone 5) follow. The sections below
> milestone 5. The sections below describe the finished game. > describe the game as it is now; they are updated in each milestone.
## Requirements ## Requirements
@@ -88,9 +88,27 @@ With the virtual environment active:
python -m snake_game python -m snake_game
``` ```
The game itself is added in milestone 2 (see the status above); this section It opens a black 600 by 600 window titled "My Snake Game". The snake of three
is completed with the controls, the two scores and the high score file in squares starts in the middle and moves to the right by itself, 20 pixels every
milestones 2 to 5. 0.1 seconds. Its body is light green and its head is dark green with a mouth.
| Key | Effect |
| --- | --- |
| Up, Down, Left, Right | Turn the snake |
The snake never turns straight back onto itself: the arrow key opposite to the
way it is going is ignored.
A small blue circle, the food, appears at a random place. When the head comes
closer to it than 15 pixels the snake eats it: the food moves to a new random
place, the snake grows by one segment, and the score at the top of the window
goes up by 1.
The game is over when the head passes the wall (more than 280 pixels from the
centre on any side) or touches the tail. The snake stops, `GAME OVER` appears in
the middle of the window, and a click on the window closes it. You can also close
the window with its close button at any time. (Milestone 3 replaces this with
continuous play and a high score.)
## Run the tests ## Run the tests
@@ -141,17 +159,19 @@ The HTML is written to `build/doxygen/index.html`. A warning fails the build.
├── docs/ business case, plan, milestones, reviews ├── docs/ business case, plan, milestones, reviews
├── src/snake_game/ the game ├── src/snake_game/ the game
│ ├── __init__.py │ ├── __init__.py
│ └── constants.py every constant of the game │ ├── __main__.py starts the game: python -m snake_game
├── tests/ pytest tests │ ├── constants.py every constant of the game
│ ├── food.py the Food class (inherits from Turtle)
│ ├── main.py screen set-up and the main flow
│ ├── scoreboard.py the Scoreboard class (inherits from Turtle)
│ └── snake.py the Snake class
├── tests/ pytest tests (fakes.py holds the fake turtle and screen)
├── Doxyfile source documentation settings ├── Doxyfile source documentation settings
├── LICENSE ├── LICENSE
├── pyproject.toml project configuration ├── pyproject.toml project configuration
└── README.md └── README.md
``` ```
The remaining modules (`snake.py`, `food.py`, `scoreboard.py`, `main.py` and
`__main__.py`) are added in milestone 2.
## License ## License
GNU Affero General Public License v3.0 only. See [LICENSE](LICENSE). GNU Affero General Public License v3.0 only. See [LICENSE](LICENSE).