Exponents and Loops
Use the repeat block to create shapes!
This project is aligned with Common Core math standards related to exponents (6.EE.A and 8.EE.A). At the high school level, this activity could be used to discuss recursive processes (HSF.BF.A); students could even use custom blocks to rewrite the sample code recursively.
The repeat block is a loop that repeats the blocks inside it a certain number of times. For example, the program below causes the Finch to move as follows: forward, turn, forward, turn, forward, turn. This script should make the Finch move in a rough triangle. Try out this program and tweak the wait times so that your robot moves in a triangle. You can attach a marker to the Finch so you can see it draw the shape.
Next, think about the code below. Before running the program, sketch the path you think the Finch will take. How many triangles will the Finch draw? How many line segments will the Finch draw? Express your answers with exponents. After you make your hypotheses, try out the program.
Finally, consider the program shown below. How many triangles will the Finch draw? How many line segments will the Finch draw? Express your answers with exponents.
How would you create a program that draws 2,187 line segments (you probably don’t want to actually run this one)?
Extension: Write a program that draws 25 pentagons.