-
Notifications
You must be signed in to change notification settings - Fork 0
/
algorithm.txt
104 lines (78 loc) · 1.24 KB
/
algorithm.txt
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
TASK FINDEXIT
VAR map = 1
VAR Up [2] = 1
VAR Down [2] = 1
VAR Left [2] = 1
VAR Right [2] = 1
//direction robot
VAR left_r = 1
VAR right_r = 1
VAR dir = 1
VAR back = 1
VAR tmp = 1
VAR tmp2 = 1
Up [1] = -1
Up [2] = 0x0
Down [2] = 0x0
Left [1] = 0x0
Left [2] = -1
Right [1] = 0x0
dir = Down
right_r = Left
left_r = Right
back = Up
VAR counter = 1
VAR edge = 4
VAR step = 0x0
VAR r_1 = 1
VAR r_2 = 1
VAR l_1 = 1
VAR l_2 = 1
VAR d_1 = 1
VAR d_2 = 1
//map[1, 3 + right_r[1], 3 + right_r[2]] - not working
FOR counter BOUNDARY edge STEP step
(
PLEASE map = GET ENVIRONMENT THANKS
PLEASE LOGITIZE map THANKS
r_1 = 3 + right_r[1]
r_2 = 3 + right_r[2]
l_1 = 3 + left_r[1]
l_2 = 3 + left_r[2]
d_1 = 3 + dir[1]
d_2 = 3 + dir[2]
SWITCH map[1, r_1 , r_2] FALSE
ROTATE RIGHT
MOVE
tmp = back
back = left_r
left_r = dir
dir = right_r
right_r = tmp
[TRUE
SWITCH map[1, d_1 , d_2] FALSE
MOVE
[TRUE
SWITCH map[1, l_1 , l_2] FALSE
ROTATE LEFT
MOVE
tmp = back
back = right_r
right_r = dir
dir = left_r
left_r = tmp
[TRUE
ROTATE LEFT
ROTATE LEFT
MOVE
tmp = back
tmp2 = right_r
back = dir
right_r = left_r
left_r = tmp2
dir = tmp
]
]
]
)
RESULT