-
Notifications
You must be signed in to change notification settings - Fork 0
/
turlemoves.cpp
41 lines (39 loc) · 952 Bytes
/
turlemoves.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "./LOGO.h"
START_PROGRAM
MAKE turtleMoves = LIST[
ARRAY{ WORD: "FORWARD", NUMBER : 100 },
ARRAY{ WORD: "RIGHT", NUMBER : 90 },
ARRAY{ WORD: "FORWARD", NUMBER : 100 },
ARRAY{ WORD: "RIGHT", NUMBER : 90 },
ARRAY{ WORD: "FORWARD", NUMBER : 100 },
ARRAY{ WORD: "LEFT", NUMBER : 90 },
ARRAY{ WORD: "FORWARD", NUMBER : 100 },
ARRAY{ WORD: "LEFT", NUMBER : 100 }
]
CENTER
SETPENCOLOR LIST[NUMBER:255, NUMBER : 255, NUMBER : 255]
REPEAT 2 TIMES
DO
FOREACH turtleMoves DO
MAKE a = ITEM({ 1 }, ELEM)
MAKE b = ITEM({2}, ELEM)
IF ITEM({ 1 }, ELEM) == "FORWARD" DO
FORWARD ITEM({ 2 }, ELEM)
ELIF ITEM({ 1 }, ELEM) == "BACK" DO
BACK ITEM({ 2 }, ELEM)
ELIF ITEM({ 1 }, ELEM) == "LEFT" DO
LEFT ITEM({ 2 }, ELEM)
ELSE
RIGHT ITEM({ 2 }, ELEM)
END
END
END
CENTER
PENUP
RIGHT NUMBER : 90
FORWARD NUMBER : 150
REPEAT 360 TIMES DO
FORWARD NUMBER : 2
LEFT NUMBER : 1
END
END_PROGRAM