1. This program draws a round track, and positions the turtle on the starting line:
dot gold, 400 dot erase, 200 pen blue, 10 bk 200 pen null fd 50 rt 90
The functions used are:
Can you figure out how each of them work?
2. This will let you race the turtle around the track using arrow keys: (Add this code to the end)
speed Infinity tick 60, -> if pressed "up" then fd 2 if pressed "left" then lt 1 if not touches gold write "Game Over" tick null
The indenting is important, because it puts indented
code under the control of a command.
tick 60, ->
the code indented under it.
speedsets the speed of the turtle.
tick 60, ->sets a timer to run a subprogram 60 times per second.
pressed "up"checks if the up-arrow key is pressed.
touches goldchecks if the turtle touches that color.
write "Game Over"shows the quoted text.
tick nullturns off the timer.
3. Questions and Challenges: