Land milestones 002 to 004 on main #34

Merged
Tirsvad merged 22 commits from mil-004-random-walk-and-spirograph into main 2026-10-07 18:47:25 +02:00
3 changed files with 11 additions and 1 deletions
Showing only changes of commit c695c47929 - Show all commits
+4 -1
View File
@@ -75,8 +75,9 @@ python -m turtle_challenges dashed-line
| --- | --- | --- |
| 1. Draw a square | `turtle-challenges square` | `draw_square` |
| 2. Draw a dashed line | `turtle-challenges dashed-line` | `draw_dashed_line` |
| 3. Draw different shapes | `turtle-challenges shapes` | `draw_shape`, `draw_shapes`, `random_color` |
Challenges 3 to 5 are added by milestones 003 and 004.
Challenges 4 and 5 are added by milestone 004.
`turtle-challenges --help` lists the challenges. If the command prints that the turtle module needs Tk, install Tk as described under Requirements.
@@ -132,8 +133,10 @@ Open `build/html/index.html` in a browser. Any Doxygen warning fails the build,
│ ├── constants.py every constant of the project
│ ├── pen.py the Pen and Window protocols the challenges use
│ ├── window.py opens the turtle window and creates the turtle
│ ├── colors.py random_color and random_palette_color
│ ├── square.py challenge 1: draw_square
│ ├── dashed_line.py challenge 2: draw_dashed_line
│ ├── shapes.py challenge 3: draw_shape, draw_shapes
│ └── cli.py the turtle-challenges command
├── tests/ pytest tests and the recording fake pen
├── Doxyfile Doxygen configuration
+3
View File
@@ -10,10 +10,12 @@ from functools import partial
from turtle_challenges.constants import (
CHALLENGE_DASHED_LINE,
CHALLENGE_NAMES,
CHALLENGE_SHAPES,
CHALLENGE_SQUARE,
)
from turtle_challenges.dashed_line import draw_dashed_line
from turtle_challenges.pen import Pen
from turtle_challenges.shapes import draw_shapes
from turtle_challenges.square import draw_square
from turtle_challenges.window import (
TurtleUnavailableError,
@@ -52,6 +54,7 @@ def build_challenges(pen: Pen) -> dict[str, Callable[[], None]]:
return {
CHALLENGE_SQUARE: partial(draw_square, pen),
CHALLENGE_DASHED_LINE: partial(draw_dashed_line, pen),
CHALLENGE_SHAPES: partial(draw_shapes, pen),
}
+4
View File
@@ -68,8 +68,12 @@ CHALLENGE_SQUARE = "square"
## Command line name of challenge 2.
CHALLENGE_DASHED_LINE = "dashed-line"
## Command line name of challenge 3.
CHALLENGE_SHAPES = "shapes"
## Names of the challenges on the command line, in the order of the course.
CHALLENGE_NAMES: tuple[str, ...] = (
CHALLENGE_SQUARE,
CHALLENGE_DASHED_LINE,
CHALLENGE_SHAPES,
)