plotter
· 4.1 KiB · Text
Brut
Playground
Handle a horizontal move.
Handle a left move.
Switch to state 'L'.
|l -> OL
Skip over the instruction stream, cells, inactive cursors and separators.
Ll -> lL
Lr -> rL
Lu -> uL
Ld -> dL
L. -> .L
L* -> *L
L; -> ;L
L[ -> [L
Shift a cursor to the left.
.LA -> A.L
*LA -> A*L
.LI -> I.L
*LI -> I*L
Skip a cursor if it can't move any further.
;LA -> ;AL
[LA -> [AL
;LI -> ;IL
[LI -> [IL
At the end of the grid, reset.
L] -> S]
Handle a right move.
Switch to state 'R'.
|r -> OR
Skip over the instruction stream, cells, inactive cursors and separators.
Rl -> lR
Rr -> rR
Ru -> uR
Rd -> dR
R. -> .R
R* -> *R
R; -> ;R
R[ -> [R
Shift a cursor to the right.
RA. -> .AR
RA* -> *AR
RI. -> .IR
RI* -> *IR
Block a right move if a cursor can't move any further.
.A; -> A.;
*A; -> A*;
.A] -> A.]
*A] -> A*]
.I; -> I.;
*I; -> I*;
.I] -> I.]
*I] -> I*]
At the end of the grid, reset.
R] -> S]
Handle a vertical move.
Handle an upward move.
Switch to state 'U'.
|u -> OU
Skip over the instruction stream, cells, inactive cursors and separators.
Ul -> lU
Ur -> rU
Uu -> uU
Ud -> dU
U. -> .U
U* -> *U
U; -> ;U
U[ -> [U
UI -> IU
Select an active cursor, switch to state 'X'.
UA -> XI
Skip to the next inactive cursor.
.X -> X.
*X -> X*
;X -> X;
Set the inactive cursor to active and reset.
IX -> SA
If you're at the start of the grid, switch to state 'E'.
[X -> [E
Seek to the nearest inactive cursor.
E. -> .E
E* -> *E
E; -> ;E
Set the inactive cursor to active and reset.
EI -> SA
Handle a downward move.
Switch to state 'D'.
|d -> OD
Skip over the instruction stream, cells, inactive cursors and separators.
Dl -> lD
Dr -> rD
Du -> uD
Dd -> dD
D. -> .D
D* -> *D
D; -> ;D
D[ -> [D
DI -> ID
Select an active cursor, switch to state 'Y'.
DA -> IY
Skip to the next inactive cursor.
Y. -> .Y
Y* -> *Y
Y; -> ;Y
Set the inactive cursor to active and reset.
YI -> SA
If you're at the end of the grid, swtich to state 'F'.
Y] -> F]
Seek to the nearest inactive cursor.
.F -> F.
*F -> F*
;F -> F;
Set the inactive cursor to active and reset.
IF -> SA
Handle a mark.
Switch to state 'M'.
|* -> OM
Skip over the instruction stream, cells, inactive cursors and separators.
Ml -> lM
Mr -> rM
Mu -> uM
Md -> dM
M. -> .M
M* -> *M
M; -> ;M
M[ -> [M
MI -> IM
Select an active cursor, toggle the pixel under it and reset.
MA. -> SA*
MA* -> SA.
Handle a reset.
Skip to the start of the instruction stream.
lS -> Sl
rS -> Sr
uS -> Su
dS -> Sd
.S -> S.
*S -> S*
;S -> S;
[S -> S[
AS -> SA
IS -> SI
Switch to state '|', ready to read another instruction.
OS -> |
Expected result:
.*.*.
..*..
*...*
.***.
Expected result (in string form):
|[.*.*I.;..*.I.;*...A*;.***I.;]
::=::
|
r*
rr*
dl*
dll*
dr*
r*
r*
ru*
[
A.....;
I.....;
I.....;
I.....;
]
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 | ] |