2011-11: Easy
Write a program that will turn and move the turtle according to the user’s input from the TextWindow.
Scrivi un programma che permetta di muovere e girare la tartaruga (nella finestra grafica) in accordo con l’input dell’utente (nella finestra di testo).
Soluzione
I comandi implementati sono: go, left, right, back, …
While "True"
TextWindow.Write("? ")
x=TextWindow.Read()
PASSO()
EndWhile
Sub PASSO
If x = "go" Then
Turtle.Move(50)
ElseIf x = "left" Then
Turtle.TurnLeft()
ElseIf x = "right" Then
Turtle.TurnRight()
ElseIf x = "back" Then
Turtle.Move(-50)
EndIf
EndSub