Add draw_shape and draw_shapes with tests

draw_shape turns 360 divided by the number of sides after each side and rejects
fewer than 3 sides. draw_shapes draws a triangle up to a decagon, each in a color
from the palette.

Task: MIL-003#3
Task: MIL-003#4
Task: MIL-003#5
This commit is contained in:
2026-10-07 23:59:05 +08:00
parent 9318a07fa0
commit 32861fc58f
5 changed files with 173 additions and 2 deletions
+12
View File
@@ -20,6 +20,9 @@ COLOR_CHANNEL_MIN = 0
## Largest value of one color channel.
COLOR_CHANNEL_MAX = COLOR_MODE
## Degrees in a full turn.
FULL_TURN_DEGREES = 360
## Degrees in a right angle.
RIGHT_ANGLE_DEGREES = 90
@@ -38,6 +41,15 @@ DASH_LENGTH = 10
## Challenge 2: length of the gap after each dash, in turtle units.
GAP_LENGTH = 10
## Challenge 3: fewest sides of a polygon (a triangle).
MIN_POLYGON_SIDES = 3
## Challenge 3: most sides of a polygon drawn in a row (a decagon).
MAX_POLYGON_SIDES = 10
## Challenge 3: length of one side of a polygon, in turtle units.
POLYGON_SIDE_LENGTH = 100
## Challenge 3: named colors a polygon is drawn in.
COLOR_PALETTE: tuple[str, ...] = (
"CornflowerBlue",