turtle-challenges shapes draws the polygons. The argument parsing tests already cover every registered name. Task: MIL-003#6
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user