Add draw_square and draw_dashed_line with tests

Challenge 1 draws four sides and turns right 90 degrees after each. Challenge 2 puts
the pen down for a dash and up for a gap and leaves it down at the end. Lengths and
counts come from constants.py; invalid values raise ValueError.

Task: MIL-002#3
Task: MIL-002#4
Task: MIL-002#5
This commit is contained in:
2026-10-07 23:58:52 +08:00
parent e2249de46e
commit a34bf6bbc2
6 changed files with 217 additions and 1 deletions
+18
View File
@@ -13,3 +13,21 @@ WINDOW_TITLE = "Turtle Challenges"
## Largest value of one color channel; also the turtle color mode, so that
## colors can be given as RGB tuples from 0 to 255.
COLOR_MODE = 255
## Degrees in a right angle.
RIGHT_ANGLE_DEGREES = 90
## Challenge 1: number of sides of a square.
SQUARE_SIDES = 4
## Challenge 1: length of one side of the square, in turtle units.
SQUARE_SIDE_LENGTH = 100
## Challenge 2: number of dashes in the dashed line.
DASH_COUNT = 50
## Challenge 2: length of one dash, in turtle units.
DASH_LENGTH = 10
## Challenge 2: length of the gap after each dash, in turtle units.
GAP_LENGTH = 10