pen.nv
· 3.8 KiB · Text
原始文件
Playground
|#| start exhaustive
|u | up
|d | down
|l | left
|r | right
|f | forward
|tl | turn left
|tr | turn right
|uu | u,u
|dd | d,d
|ll | l,l
|rr | r,r
|ff | f,f
|tll | tl,tl
|trr | tr,tr
|uuu | uu,u
|ddd | dd,d
|lll | ll,l
|rrr | rr,r
|fff | ff,f
|tlll | tll,tl
|trrr | trr,tr
|uuuu | uu,uu
|dddd | dd,dd
|llll | ll,ll
|rrrr | rr,rr
|ffff | ff,ff
|tllll | tll,tll
|trrrr | trr,trr
|up | @pen-up
|down | @pen-down
|left | @pen-left
|right | @pen-right
|forward | @pen-forward
|turn left | @pen-turn-left
|turn right| @pen-turn-right
|pen down | @pen-start
|pen up | @pen-stop
|#| end exhaustive
|#| start exhaustive
|@pen-start| @pen-draw
|@pen-stop, @pen-draw|
|@pen-stop|
||@pen-direction-right
|@pen-forward, @pen-direction-up | @pen-up, @pen-direction-up
|@pen-forward, @pen-direction-down | @pen-down, @pen-direction-down
|@pen-forward, @pen-direction-left | @pen-left, @pen-direction-left
|@pen-forward, @pen-direction-right| @pen-right, @pen-direction-right
|@pen-turn-left, @pen-direction-up | @pen-direction-left
|@pen-turn-left, @pen-direction-down | @pen-direction-right
|@pen-turn-left, @pen-direction-left | @pen-direction-down
|@pen-turn-left, @pen-direction-right| @pen-direction-up
|@pen-turn-right, @pen-direction-up | @pen-direction-right
|@pen-turn-right, @pen-direction-down | @pen-direction-left
|@pen-turn-right, @pen-direction-left | @pen-direction-up
|@pen-turn-right, @pen-direction-right| @pen-direction-down
|@pixel-x = @pen-x, @pen-x | @pen-x-temp,
@pixel-x,
@pixel-x = @pen-x
|@pixel-x = @pen-x | @pen-x <- @pen-x-temp
|@pen-x <- @pen-x-temp, @pen-x-temp | @pen-x, @pen-x <- @pen-x-temp
|@pen-x <- @pen-x-temp |
|@pixel-y = @pen-y, @pen-y | @pen-y-temp,
@pixel-y,
@pixel-y = @pen-y
|@pixel-y = @pen-y | @pen-y <- @pen-y-temp
|@pen-y <- @pen-y-temp, @pen-y-temp | @pen-y, @pen-y <- @pen-y-temp
|@pen-y <- @pen-y-temp |
|@pen-x++| @pen-x
|@pen-x--, @pen-x|
|@pen-x--|
|@pen-y++| @pen-y
|@pen-y--, @pen-y|
|@pen-y--|
|#| end exhaustive
|@trigger-set-pixel| @set-pixel
|@pen-left, @pen-draw|
@pixel-x = @pen-x,
@pixel-y = @pen-y,
@pen-draw,
@trigger-set-pixel,
@pen-x--
|@pen-left|
@pen-x--
|@pen-right, @pen-draw|
@pixel-x = @pen-x,
@pixel-y = @pen-y,
@pen-draw,
@trigger-set-pixel,
@pen-x++
|@pen-right|
@pen-x++
|@pen-up, @pen-draw|
@pixel-x = @pen-x,
@pixel-y = @pen-y,
@pen-draw,
@trigger-set-pixel,
@pen-y--
|@pen-up|
@pen-y--
|@pen-down, @pen-draw|
@pixel-x = @pen-x,
@pixel-y = @pen-y,
@pen-draw,
@trigger-set-pixel,
@pen-y++
|@pen-down|
@pen-y++
|H|H1
|H1|H2,
pen down,
dddd,dddd,dddd,dddd,
dddd,dddd,dddd,dddd
|H2|H3,
pen up,
uuuu,uuuu,
uuuu,uuuu
|H3|H4,
pen down,
rrrr,
rrrr
|H4|H5,
uuuu,uuuu,
uuuu,uuuu
|H5|H6,
dddd,dddd,dddd,dddd,
dddd,dddd,dddd,dddd
|H6|
pen up,
uuuu,uuuu,uuuu,uuuu,
uuuu,uuuu,uuuu,uuuu,
rrrr
|i|i1
|i1|i2,
pen up,
dddd,dddd,dddd,dddd,
dddd,dddd,dddd,ddd
|i2|i3,
pen down,
uuuu,uuuu,uuuu,uuu
|i3|i4,
pen up,
uuuu,uuuu
|i4|i5,
pen down,
uuuu,uuuu
|i5|
pen up,
llll,llll,llll
|| start
|start|
pen up,
rrrr,rrrr,rrrr,rrrr,
dddd,dddd,dddd,dddd,
main
|main|
draw a frame,
loop
|draw a frame| Hi
|Hi| H,i
|display| @display
|loop, @quit|
|loop| main
1 | |#| start exhaustive |
2 | |u | up |
3 | |d | down |
4 | |l | left |
5 | |r | right |
6 | |f | forward |
7 | |tl | turn left |
8 | |tr | turn right |
9 | |uu | u,u |
10 | |dd | d,d |
11 | |ll | l,l |
12 | |rr | r,r |
13 | |ff | f,f |
14 | |tll | tl,tl |
15 | |trr | tr,tr |
16 | |uuu | uu,u |
17 | |ddd | dd,d |
18 | |lll | ll,l |
19 | |rrr | rr,r |
20 | |fff | ff,f |
21 | |tlll | tll,tl |
22 | |trrr | trr,tr |
23 | |uuuu | uu,uu |
24 | |dddd | dd,dd |
25 | |llll | ll,ll |
26 | |rrrr | rr,rr |
27 | |ffff | ff,ff |
28 | |tllll | tll,tll |
29 | |trrrr | trr,trr |
30 | |up | @pen-up |
31 | |down | @pen-down |
32 | |left | @pen-left |
33 | |right | @pen-right |
34 | |forward | @pen-forward |
35 | |turn left | @pen-turn-left |
36 | |turn right| @pen-turn-right |
37 | |pen down | @pen-start |
38 | |pen up | @pen-stop |
39 | |#| end exhaustive |
40 | |
41 | |#| start exhaustive |
42 | |@pen-start| @pen-draw |
43 | |@pen-stop, @pen-draw| |
44 | |@pen-stop| |
45 | |
46 | ||@pen-direction-right |
47 | |@pen-forward, @pen-direction-up | @pen-up, @pen-direction-up |
48 | |@pen-forward, @pen-direction-down | @pen-down, @pen-direction-down |
49 | |@pen-forward, @pen-direction-left | @pen-left, @pen-direction-left |
50 | |@pen-forward, @pen-direction-right| @pen-right, @pen-direction-right |
51 | |
52 | |@pen-turn-left, @pen-direction-up | @pen-direction-left |
53 | |@pen-turn-left, @pen-direction-down | @pen-direction-right |
54 | |@pen-turn-left, @pen-direction-left | @pen-direction-down |
55 | |@pen-turn-left, @pen-direction-right| @pen-direction-up |
56 | |
57 | |@pen-turn-right, @pen-direction-up | @pen-direction-right |
58 | |@pen-turn-right, @pen-direction-down | @pen-direction-left |
59 | |@pen-turn-right, @pen-direction-left | @pen-direction-up |
60 | |@pen-turn-right, @pen-direction-right| @pen-direction-down |
61 | |
62 | |@pixel-x = @pen-x, @pen-x | @pen-x-temp, |
63 | @pixel-x, |
64 | @pixel-x = @pen-x |
65 | |@pixel-x = @pen-x | @pen-x <- @pen-x-temp |
66 | |@pen-x <- @pen-x-temp, @pen-x-temp | @pen-x, @pen-x <- @pen-x-temp |
67 | |@pen-x <- @pen-x-temp | |
68 | |
69 | |@pixel-y = @pen-y, @pen-y | @pen-y-temp, |
70 | @pixel-y, |
71 | @pixel-y = @pen-y |
72 | |@pixel-y = @pen-y | @pen-y <- @pen-y-temp |
73 | |@pen-y <- @pen-y-temp, @pen-y-temp | @pen-y, @pen-y <- @pen-y-temp |
74 | |@pen-y <- @pen-y-temp | |
75 | |
76 | |@pen-x++| @pen-x |
77 | |@pen-x--, @pen-x| |
78 | |@pen-x--| |
79 | |
80 | |@pen-y++| @pen-y |
81 | |@pen-y--, @pen-y| |
82 | |@pen-y--| |
83 | |#| end exhaustive |
84 | |
85 | |@trigger-set-pixel| @set-pixel |
86 | |
87 | |@pen-left, @pen-draw| |
88 | @pixel-x = @pen-x, |
89 | @pixel-y = @pen-y, |
90 | @pen-draw, |
91 | @trigger-set-pixel, |
92 | @pen-x-- |
93 | |
94 | |@pen-left| |
95 | @pen-x-- |
96 | |
97 | |@pen-right, @pen-draw| |
98 | @pixel-x = @pen-x, |
99 | @pixel-y = @pen-y, |
100 | @pen-draw, |
101 | @trigger-set-pixel, |
102 | @pen-x++ |
103 | |
104 | |@pen-right| |
105 | @pen-x++ |
106 | |
107 | |@pen-up, @pen-draw| |
108 | @pixel-x = @pen-x, |
109 | @pixel-y = @pen-y, |
110 | @pen-draw, |
111 | @trigger-set-pixel, |
112 | @pen-y-- |
113 | |
114 | |@pen-up| |
115 | @pen-y-- |
116 | |
117 | |@pen-down, @pen-draw| |
118 | @pixel-x = @pen-x, |
119 | @pixel-y = @pen-y, |
120 | @pen-draw, |
121 | @trigger-set-pixel, |
122 | @pen-y++ |
123 | |
124 | |@pen-down| |
125 | @pen-y++ |
126 | |
127 | |H|H1 |
128 | |H1|H2, |
129 | pen down, |
130 | dddd,dddd,dddd,dddd, |
131 | dddd,dddd,dddd,dddd |
132 | |H2|H3, |
133 | pen up, |
134 | uuuu,uuuu, |
135 | uuuu,uuuu |
136 | |H3|H4, |
137 | pen down, |
138 | rrrr, |
139 | rrrr |
140 | |H4|H5, |
141 | uuuu,uuuu, |
142 | uuuu,uuuu |
143 | |H5|H6, |
144 | dddd,dddd,dddd,dddd, |
145 | dddd,dddd,dddd,dddd |
146 | |H6| |
147 | pen up, |
148 | uuuu,uuuu,uuuu,uuuu, |
149 | uuuu,uuuu,uuuu,uuuu, |
150 | rrrr |
151 | |i|i1 |
152 | |i1|i2, |
153 | pen up, |
154 | dddd,dddd,dddd,dddd, |
155 | dddd,dddd,dddd,ddd |
156 | |i2|i3, |
157 | pen down, |
158 | uuuu,uuuu,uuuu,uuu |
159 | |i3|i4, |
160 | pen up, |
161 | uuuu,uuuu |
162 | |i4|i5, |
163 | pen down, |
164 | uuuu,uuuu |
165 | |i5| |
166 | pen up, |
167 | llll,llll,llll |
168 | |
169 | || start |
170 | |start| |
171 | pen up, |
172 | rrrr,rrrr,rrrr,rrrr, |
173 | dddd,dddd,dddd,dddd, |
174 | main |
175 | |main| |
176 | draw a frame, |
177 | loop |
178 | |draw a frame| Hi |
179 | |Hi| H,i |
180 | |display| @display |
181 | |loop, @quit| |
182 | |loop| main |