Utoljára aktív 1747406569

Revízió 1b59b715986c675309d26888859902959d6ced8f

maze.nv Eredeti Playground
1= || jump pen x |pen position| $oldx $y |@math| $x =
2 |pen position| $x $y
3
4= || jump pen y |pen position| $x $oldy |@math| $y =
5 |pen position| $x $y
6
7= || jump |backtrack| $row $col =
8 |@math| multiply $col 2
9 |@math| multiply $row 2
10 || jump pen x || jump pen y
11 |matrix position| $row $col
12= || jump |generate| =
13
14= || restore cells |discarded cells| $row $col =
15 |cells| $row $col || restore cells
16= || restore cells =
17
18= || delete cell |location| $row $col |cells| $row $col =
19 || restore cells
20= || delete cell |location| $row $col? |cells| $r $c =
21 |discarded cells| $r $c
22 || delete cell
23= || delete cell |location| $row $col =
24 || restore cells
25
26= || prepare cells |cells| 127 |@math| 127 =
27 |cells| 127 127
28
29= || next column |@math| $col =
30 |cells| 0 $col
31 || prepare cells
32
33= || prepare cells |cells| $col |@math| 127 =
34 |@math|add $col 1
35 |cells| 127 $col
36 || next column
37
38= || prepare cells |cells| $col |@math| $row =
39 |@math| add $row 1
40 |cells| $col
41 |cells| $row $col
42 || prepare cells
43
44= || prepare cells |cells| $row $col =
45 |@math| add $row 1
46 |cells| $col
47 |cells| $row $col
48 || prepare cells
49
50= || compute down $col |@math| $row =
51 |down neighbor| $row $col
52
53= || compute right $row |@math| $col =
54 |right neighbor| $row $col
55
56= || compute up $col |@math| $row =
57 |up neighbor| $row $col
58
59= || compute left $row |@math| $col =
60 |left neighbor| $row $col
61
62= || find valid neighbors? |down neighbor| $row $col |cells| $row $col =
63 |discarded cells| $row $col
64 |valid down neighbor| $row $col
65
66= || find valid neighbors? |right neighbor| $row $col |cells| $row $col =
67 |discarded cells| $row $col
68 |valid right neighbor| $row $col
69
70= || find valid neighbors? |up neighbor| $row $col |cells| $row $col =
71 |discarded cells| $row $col
72 |valid up neighbor| $row $col
73
74= || find valid neighbors? |left neighbor| $row $col |cells| $row $col =
75 |discarded cells| $row $col
76 |valid left neighbor| $row $col
77
78= || find valid neighbors? |cells| $row $col =
79 |discarded cells| $row $col
80
81= |up neighbor| $row $col =
82= |right neighbor| $row $col =
83= |down neighbor| $row $col =
84= |left neighbor| $row $col =
85
86= || find valid neighbors =
87 || restore cells
88
89= || find neighbors |location| $row $col =
90 || compute down $col |@math| add $row 1
91 || compute right $row |@math| add $col 1
92 || compute up $col |@math| add $row -1
93 || compute left $row |@math| add $col -1
94 || find valid neighbors
95
96= || go in direction |@math| 1 |valid up neighbor| $row $col =
97 || move up || move up
98 || delete cell |location| $row $col
99 |matrix position| $row $col || clear navigation state
100
101= || go in direction |@math| 2 |valid right neighbor| $row $col =
102 || move right || move right
103 || delete cell |location| $row $col
104 |matrix position| $row $col || clear navigation state
105
106= || go in direction |@math| 3 |valid down neighbor| $row $col =
107 || move down || move down
108 || delete cell |location| $row $col
109 |matrix position| $row $col || clear navigation state
110
111= || go in direction |@math| 4 |valid left neighbor| $row $col =
112 || move left || move left
113 || delete cell |location| $row $col
114 |matrix position| $row $col || clear navigation state
115
116= || go in direction? |@math| 1 |sweep|=
117 |@math| 2
118= || go in direction? |@math| 2 |sweep|=
119 |@math| 3
120= || go in direction? |@math| 3 |sweep|=
121 |@math| 4
122= || go in direction? |@math| 4 |sweep|=
123 |@math| 1
124
125= || go in direction |@math| $n =
126 || clear navigation state || jump
127
128= || push location to backtrack stack |location| $row $col =
129 |backtrack| $row $col
130
131= || push location to backtrack stack =
132
133= || clear navigation state? |valid up neighbor| $r $c =
134 || push location to backtrack stack
135= || clear navigation state? |valid left neighbor| $r $c =
136 || push location to backtrack stack
137= || clear navigation state? |valid down neighbor| $r $c =
138 || push location to backtrack stack
139= || clear navigation state? |valid right neighbor| $r $c =
140 || push location to backtrack stack
141= || clear navigation state? |sweep| =
142= || clear navigation state =
143
144= || pick a random direction |matrix position| $row $col =
145 || find neighbors |location| $row $col
146 || go in direction |location| $row $col |sweep| |sweep| |sweep|
147 |@math| random 1 5
148
149= || update |generate|? =
150 || pick a random direction
151
152==
153 |cells| 1 0 |matrix position| 0 0 |screen resolution| 256 256
154 || prepare cells
155 || pen brush pencil
156 || pen down
157 || pen color 255 255 255
158 |generate|
159
160