Ultima attività 1729901822

A sample pen plotter program that draws 'Hi'.

Revisione 79d083faa082fb07cebfb04440e926826b22fe38

hi.nv Raw Playground
1|#| start exhaustive
2|H|H1
3 |H1|H2,
4 pen down,
5 dddd,dddd,dddd,dddd,
6 dddd,dddd,dddd,dddd
7 |H2|H3,
8 pen up,
9 uuuu,uuuu,
10 uuuu,uuuu
11 |H3|H4,
12 pen down,
13 rrrr,
14 rrrr
15 |H4|H5,
16 uuuu,uuuu,
17 uuuu,uuuu
18 |H5|H6,
19 dddd,dddd,dddd,dddd,
20 dddd,dddd,dddd,dddd
21 |H6|
22 pen up,
23 uuuu,uuuu,uuuu,uuuu,
24 uuuu,uuuu,uuuu,uuuu,
25 rrrr
26|i|i1
27 |i1|i2,
28 pen up,
29 dddd,dddd,dddd,dddd,
30 dddd,dddd,dddd,ddd
31 |i2|i3,
32 pen down,
33 uuuu,uuuu,uuuu,uuu
34 |i3|i4,
35 pen up,
36 uuuu,uuuu
37 |i4|i5,
38 pen down,
39 uuuu,uuuu
40 |i5|
41 pen up,
42 llll,llll,llll
43
44|| start
45|start|
46 set up the screen,
47 pen up,
48 rrrr,rrrr,rrrr,rrrr,
49 dddd,dddd,dddd,dddd,
50 main
51|set up the screen|
52 @resolution-x += 255,
53 @resolution-x += 255,
54 @resolution-y += 255,
55 @resolution-y += 255,
56 set the screen resolution
57|set the screen resolution| @set-resolution
58|main|
59 poll for input,
60 clear the screen,
61 draw a frame,
62 display,
63 loop
64|poll for input| @poll-input
65|clear the screen| @clear-screen
66|draw a frame|1
67|1|2, H,
68|2| , i
69|display| @display
70|loop, @quit|
71|loop| main
72|#| end exhaustive
pen-dsl.nv Raw Playground
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
40|@pen-start| @pen-draw
41|@pen-stop, @pen-draw| @pen-stop
42|@pen-stop|
43
44||@pen-direction-right
45|@pen-forward, @pen-direction-up | @pen-up, @pen-direction-up
46|@pen-forward, @pen-direction-down | @pen-down, @pen-direction-down
47|@pen-forward, @pen-direction-left | @pen-left, @pen-direction-left
48|@pen-forward, @pen-direction-right| @pen-right, @pen-direction-right
49
50|@pen-turn-left, @pen-direction-up | @pen-direction-left
51|@pen-turn-left, @pen-direction-down | @pen-direction-right
52|@pen-turn-left, @pen-direction-left | @pen-direction-down
53|@pen-turn-left, @pen-direction-right| @pen-direction-up
54
55|@pen-turn-right, @pen-direction-up | @pen-direction-right
56|@pen-turn-right, @pen-direction-down | @pen-direction-left
57|@pen-turn-right, @pen-direction-left | @pen-direction-up
58|@pen-turn-right, @pen-direction-right| @pen-direction-down
59
60|@pen-lift, @pen-draw| @pen-lift
61|@pen-lift|
62
63|#| constant, @pixel-x = @pen-x, 18446744073709551615
64|#| constant, @pixel-y = @pen-y, 18446744073709551615
65|#| constant, @pen-x <- @pen-x-temp, 18446744073709551615
66|#| constant, @pen-y <- @pen-y-temp, 18446744073709551615
67|@pixel-x = @pen-x:max| @pixel-x = @pen-x:18446744073709551615
68|@pixel-y = @pen-y:max| @pixel-y = @pen-y:18446744073709551615
69|@pen-x <- @pen-x-temp:max| @pen-x <- @pen-x-temp:18446744073709551615
70|@pen-y <- @pen-y-temp:max| @pen-y <- @pen-y-temp:18446744073709551615
71
72|@pixel-x = @pen-x, @pen-x | @pen-x-temp,
73 @pixel-x,
74 @pixel-x = @pen-x
75|@pixel-x = @pen-x | @pen-x <- @pen-x-temp:max
76|@pen-x <- @pen-x-temp, @pen-x-temp | @pen-x, @pen-x <- @pen-x-temp
77|@pen-x <- @pen-x-temp |
78
79|@pixel-y = @pen-y, @pen-y | @pen-y-temp,
80 @pixel-y,
81 @pixel-y = @pen-y
82|@pixel-y = @pen-y | @pen-y <- @pen-y-temp:max
83|@pen-y <- @pen-y-temp, @pen-y-temp | @pen-y, @pen-y <- @pen-y-temp
84|@pen-y <- @pen-y-temp |
85
86|@trigger-set-pixel| @pixel-r += 255, @pixel-g += 255, @pixel-b += 255, set pixel
87|set pixel| @set-pixel
88
89|@pen-x++| @pen-x
90|@pen-x--, @pen-x|
91|@pen-x--|
92
93|@pen-y++| @pen-y
94|@pen-y--, @pen-y|
95|@pen-y--|
96
97|@pen-left, @pen-draw|
98 @pixel-x = @pen-x:max,
99 @pixel-y = @pen-y:max,
100 @pen-draw,
101 @trigger-set-pixel,
102 @pen-x--
103
104|@pen-left|
105 @pen-x--
106
107|@pen-right, @pen-draw|
108 @pixel-x = @pen-x:max,
109 @pixel-y = @pen-y:max,
110 @pen-draw,
111 @trigger-set-pixel,
112 @pen-x++
113
114|@pen-right|
115 @pen-x++
116
117|@pen-up, @pen-draw|
118 @pixel-x = @pen-x:max,
119 @pixel-y = @pen-y:max,
120 @pen-draw,
121 @trigger-set-pixel,
122 @pen-y--
123
124|@pen-up|
125 @pen-y--
126
127|@pen-down, @pen-draw|
128 @pixel-x = @pen-x:max,
129 @pixel-y = @pen-y:max,
130 @pen-draw,
131 @trigger-set-pixel,
132 @pen-y++
133
134|@pen-down|
135 @pen-y++
136|#| end exhaustive
137