First forward into Logo 12: puzzling sums
Can you puzzle out what sequences these Logo programs will give? Then write your own Logo programs to generate sequences.
Problem
First Forward Into Logo
Previous: FF11
In FF9 you looked at several different sequences of numbers. Here are more programs that generate sequences.
Now consider the following procedures. TO SUMO :X :N PR :X WAIT 120 SUMO :X + :N :N + 2 END
What do you think is happening this time? Try 'chasing' through the procedure the values: x= 1 and n = 1. The output from this program is given on the right.
Now why not experiment further by changing the fourth line? For example: TO SUMO :X :N PR :X WAIT 120 SUMO :X + :N :N + 3 END
Or SUMO :X * :N :N - 3 SUMO :X + :N * 2 :N + 1 SUMO :X - :N :N + 3 Etc Any surprises? | Image
|
1 2 5 10 17 26 37 50 65 82 101 122 stopped in SUMO
2 6 8 8 6 2 -4 -12 -22 -34 -48 stopped in SUMO |
You might like to learn more Logo programming with Muggles, Logo and Gradients if you have not worked through it yet.