Ostatnio aktywny 1741147058

A pen plotter in string rewriting.

wryl zrewidował ten Gist 1741147058. Przejdź do rewizji

1 file changed, 0 insertions, 0 deletions

plotter.p zmieniono nazwę na plotter

Zmieniono nazwę pliku bez modyfikacji zawartości

wryl zrewidował ten Gist 1741147040. Przejdź do rewizji

1 file changed, 189 insertions

plotter.p(stworzono plik)

@@ -0,0 +1,189 @@
1 + Handle a horizontal move.
2 + Handle a left move.
3 + Switch to state 'L'.
4 + |l -> OL
5 + Skip over the instruction stream, cells, inactive cursors and separators.
6 + Ll -> lL
7 + Lr -> rL
8 + Lu -> uL
9 + Ld -> dL
10 + L. -> .L
11 + L* -> *L
12 + L; -> ;L
13 + L[ -> [L
14 + Shift a cursor to the left.
15 + .LA -> A.L
16 + *LA -> A*L
17 + .LI -> I.L
18 + *LI -> I*L
19 + Skip a cursor if it can't move any further.
20 + ;LA -> ;AL
21 + [LA -> [AL
22 + ;LI -> ;IL
23 + [LI -> [IL
24 + At the end of the grid, reset.
25 + L] -> S]
26 + Handle a right move.
27 + Switch to state 'R'.
28 + |r -> OR
29 + Skip over the instruction stream, cells, inactive cursors and separators.
30 + Rl -> lR
31 + Rr -> rR
32 + Ru -> uR
33 + Rd -> dR
34 + R. -> .R
35 + R* -> *R
36 + R; -> ;R
37 + R[ -> [R
38 + Shift a cursor to the right.
39 + RA. -> .AR
40 + RA* -> *AR
41 + RI. -> .IR
42 + RI* -> *IR
43 + Block a right move if a cursor can't move any further.
44 + .A; -> A.;
45 + *A; -> A*;
46 + .A] -> A.]
47 + *A] -> A*]
48 + .I; -> I.;
49 + *I; -> I*;
50 + .I] -> I.]
51 + *I] -> I*]
52 + At the end of the grid, reset.
53 + R] -> S]
54 +
55 +
56 +
57 +
58 + Handle a vertical move.
59 + Handle an upward move.
60 + Switch to state 'U'.
61 + |u -> OU
62 + Skip over the instruction stream, cells, inactive cursors and separators.
63 + Ul -> lU
64 + Ur -> rU
65 + Uu -> uU
66 + Ud -> dU
67 + U. -> .U
68 + U* -> *U
69 + U; -> ;U
70 + U[ -> [U
71 + UI -> IU
72 + Select an active cursor, switch to state 'X'.
73 + UA -> XI
74 + Skip to the next inactive cursor.
75 + .X -> X.
76 + *X -> X*
77 + ;X -> X;
78 + Set the inactive cursor to active and reset.
79 + IX -> SA
80 + If you're at the start of the grid, switch to state 'E'.
81 + [X -> [E
82 + Seek to the nearest inactive cursor.
83 + E. -> .E
84 + E* -> *E
85 + E; -> ;E
86 + Set the inactive cursor to active and reset.
87 + EI -> SA
88 + Handle a downward move.
89 + Switch to state 'D'.
90 + |d -> OD
91 + Skip over the instruction stream, cells, inactive cursors and separators.
92 + Dl -> lD
93 + Dr -> rD
94 + Du -> uD
95 + Dd -> dD
96 + D. -> .D
97 + D* -> *D
98 + D; -> ;D
99 + D[ -> [D
100 + DI -> ID
101 + Select an active cursor, switch to state 'Y'.
102 + DA -> IY
103 + Skip to the next inactive cursor.
104 + Y. -> .Y
105 + Y* -> *Y
106 + Y; -> ;Y
107 + Set the inactive cursor to active and reset.
108 + YI -> SA
109 + If you're at the end of the grid, swtich to state 'F'.
110 + Y] -> F]
111 + Seek to the nearest inactive cursor.
112 + .F -> F.
113 + *F -> F*
114 + ;F -> F;
115 + Set the inactive cursor to active and reset.
116 + IF -> SA
117 +
118 +
119 +
120 +
121 + Handle a mark.
122 + Switch to state 'M'.
123 + |* -> OM
124 + Skip over the instruction stream, cells, inactive cursors and separators.
125 + Ml -> lM
126 + Mr -> rM
127 + Mu -> uM
128 + Md -> dM
129 + M. -> .M
130 + M* -> *M
131 + M; -> ;M
132 + M[ -> [M
133 + MI -> IM
134 + Select an active cursor, toggle the pixel under it and reset.
135 + MA. -> SA*
136 + MA* -> SA.
137 +
138 +
139 +
140 +
141 + Handle a reset.
142 + Skip to the start of the instruction stream.
143 + lS -> Sl
144 + rS -> Sr
145 + uS -> Su
146 + dS -> Sd
147 + .S -> S.
148 + *S -> S*
149 + ;S -> S;
150 + [S -> S[
151 + AS -> SA
152 + IS -> SI
153 + Switch to state '|', ready to read another instruction.
154 + OS -> |
155 +
156 +
157 +
158 +
159 + Expected result:
160 + .*.*.
161 + ..*..
162 + *...*
163 + .***.
164 + Expected result (in string form):
165 + |[.*.*I.;..*.I.;*...A*;.***I.;]
166 +
167 +
168 +
169 +
170 + ::=::
171 +
172 +
173 +
174 +
175 + |
176 + r*
177 + rr*
178 + dl*
179 + dll*
180 + dr*
181 + r*
182 + r*
183 + ru*
184 + [
185 + A.....;
186 + I.....;
187 + I.....;
188 + I.....;
189 + ]
Nowsze Starsze