Chapter Two -- Repeat
Lesson 1:
Introducing REPEAT
Reconsider
drawing a square: Repeat a group of commands -- FD 50 RT 90
drawing stairs: Repeat a group of commands -- FD 20 RT 90 FD 20 LT 90
drawing a dotted line: Repeat a group of commands -- PD FD 10 PU FD 10
REPEAT
Whenever a group of commands is repeated more than once
Format: REPEAT <number> [<a group of commands>]
Example:
REPEAT 4 [FD 50 RT 90] -- draw a square
REPEAT 5 [FD 20 RT 90 FD 20 LT 90] -- draw five stairs
REPEAT 10 [PD FD 10 PU FD 10] -- draw a dotted line with 10 segments
Activities: A) D) E) F)
Exploration: Paper work, program, and compare
Lesson 2:
Using REPEAT to Make a Rectangle
- A rectangle can be divided into two right angles: upper-left, and lower-right
- Each right angle can be drawn with a set of two commands:
- FD 30 RT 90 FD 60 RT 90
- The right angle is repeated twice:
- REPEAT 2 [FD 30 RT 90 FD 60 RT 90]
Activities: A), B), C)
Exploration: Paper work, program, and compare
Lesson 3:
Positing Your Design on the Screen
- Move the turtle without drawing: PENUP -- PU
- Draw a picture at a specific position
- Predicting:
- DRAW
- PU FD 100 PD
- REPEAT 4 [FD 30 RT 90]
- Draw a cross
- DRAW
- LT 45
- REPEAT 4 [FD 50 BK 50 RT 90]
Activities: A) B) C) D)
Exploration: Paper work, program, and compare
Lesson 4:
Patterns Using REPEAT
- Figure out patterns that constitute a given picture
- Figure out how patterns are drawn
- Use repeat as possible as you can
- Examples:
- Draw two separate squares
- REPEAT 4 [FD 30 RT 90]
- PU RT 90 FD 70 LT 90 PD
- REPEAT 4 [FD 30 RT 90]
- Draw two separate squares with different orientation (tilt shape)
- Change the turtle's heading before it draws the squares
- Predict:
- REPEAT 5 [FD 20 LT 30 BK 40 RT 30]
Activities: A) B) C) D) E)
Exploration: Paper work, program, and compare
Lesson 5:
Putting it all Together
- Use REPEAT to make a square
- Draw a picture at any position
- Identify patterns
- Use REPEAT to make patterns and designs
- Repeat patterns
Activities: A) B) C) D) E) F)