Add random_walk with tests

200 steps of equal length, each in a random heading of 0, 90, 180 or 270 degrees and
a random RGB color, with a thick line and the fastest speed.

Task: MIL-004#1
This commit is contained in:
2026-10-07 23:59:10 +08:00
parent c695c47929
commit 949d2edb63
5 changed files with 183 additions and 2 deletions
+15
View File
@@ -26,6 +26,9 @@ FULL_TURN_DEGREES = 360
## Degrees in a right angle.
RIGHT_ANGLE_DEGREES = 90
## Turtle speed setting for "fastest": no animation between moves.
FASTEST_SPEED = 0
## Challenge 1: number of sides of a square.
SQUARE_SIDES = 4
@@ -62,6 +65,18 @@ COLOR_PALETTE: tuple[str, ...] = (
"SeaGreen",
)
## Challenge 4: number of steps of the random walk.
WALK_STEPS = 200
## Challenge 4: distance of one step, in turtle units.
WALK_STEP_DISTANCE = 30
## Challenge 4: thickness of the line, in pixels.
WALK_PEN_SIZE = 10
## Challenge 4: headings of a step: east, north, west and south, in degrees.
WALK_HEADINGS: tuple[int, ...] = (0, 90, 180, 270)
## Command line name of challenge 1.
CHALLENGE_SQUARE = "square"