diff options
author | Case Duckworth | 2022-07-06 22:19:46 -0500 |
---|---|---|
committer | Case Duckworth | 2022-07-06 22:19:46 -0500 |
commit | cdfe94135fe8ab1f407bb5e09c3cea93ec300469 (patch) | |
tree | 899b4aa91fd88bbaf3b1008950dcf5b6bff1b1f5 /examples/rot13.tf | |
parent | Fix other help (diff) | |
download | trainfuck-cdfe94135fe8ab1f407bb5e09c3cea93ec300469.tar.gz trainfuck-cdfe94135fe8ab1f407bb5e09c3cea93ec300469.zip |
Fix examples
Diffstat (limited to 'examples/rot13.tf')
-rw-r--r-- | examples/rot13.tf | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/examples/rot13.tf b/examples/rot13.tf index f7c24df..31a6829 100644 --- a/examples/rot13.tf +++ b/examples/rot13.tf | |||
@@ -5,12 +5,12 @@ from https://en.wikipedia.org/wiki/Brainfuck#ROT13 | |||
5 | 5 | ||
6 | 6 | ||
7 | ALL ABOARD | 7 | ALL ABOARD |
8 | chugga clack chug tickets please | 8 | chugga clack chug tickets please |
9 | END OF THE LINE | 9 | END OF THE LINE |
10 | Read first character and start outer character reading loop | 10 | Read first character and start outer character reading loop |
11 | 11 | ||
12 | ALL ABOARD | 12 | ALL ABOARD |
13 | chugga tickets please | 13 | chugga tickets please |
14 | END OF THE LINE | 14 | END OF THE LINE |
15 | Skip forward if character is 0 | 15 | Skip forward if character is 0 |
16 | 16 | ||
@@ -18,9 +18,9 @@ ALL ABOARD | |||
18 | choo | 18 | choo |
19 | choo | 19 | choo |
20 | chug chug chug chug tickets please choo | 20 | chug chug chug chug tickets please choo |
21 | chug chug chug chug chug chug chug chug | 21 | chug chug chug chug chug chug chug chug |
22 | choo choo | 22 | choo choo |
23 | chugga your ticket please | 23 | chugga your ticket please |
24 | END OF THE LINE | 24 | END OF THE LINE |
25 | Set up divisor (32) for division loop | 25 | Set up divisor (32) for division loop |
26 | (MEMORY LAYOUT: dividend copy remainder divisor quotient zero zero) | 26 | (MEMORY LAYOUT: dividend copy remainder divisor quotient zero zero) |
@@ -28,7 +28,7 @@ END OF THE LINE | |||
28 | ALL ABOARD | 28 | ALL ABOARD |
29 | choo choo | 29 | choo choo |
30 | chug choo choo | 30 | chug choo choo |
31 | chugga tickets please | 31 | chugga tickets please |
32 | END OF THE LINE | 32 | END OF THE LINE |
33 | Set up dividend (x minus 1) and enter division loop | 33 | Set up dividend (x minus 1) and enter division loop |
34 | 34 | ||
@@ -39,7 +39,7 @@ chug choo | |||
39 | chugga tickets please choo | 39 | chugga tickets please choo |
40 | choo | 40 | choo |
41 | choo | 41 | choo |
42 | your ticket please | 42 | your ticket please |
43 | END OF THE LINE | 43 | END OF THE LINE |
44 | Increase copy and remainder / reduce divisor / Normal case: skip forward | 44 | Increase copy and remainder / reduce divisor / Normal case: skip forward |
45 | 45 | ||
@@ -50,7 +50,7 @@ chug choo choo | |||
50 | chugga your ticket please choo | 50 | chugga your ticket please choo |
51 | choo | 51 | choo |
52 | chug choo | 52 | chug choo |
53 | your ticket please | 53 | your ticket please |
54 | 54 | ||
55 | END OF THE LINE | 55 | END OF THE LINE |
56 | Special case: move remainder back to divisor and increase quotient | 56 | Special case: move remainder back to divisor and increase quotient |
@@ -61,12 +61,12 @@ choo choo | |||
61 | choo choo | 61 | choo choo |
62 | choo choo | 62 | choo choo |
63 | choo choo | 63 | choo choo |
64 | chugga | 64 | chugga |
65 | END OF THE LINE | 65 | END OF THE LINE |
66 | Decrement dividend | 66 | Decrement dividend |
67 | 67 | ||
68 | ALL ABOARD | 68 | ALL ABOARD |
69 | your ticket please | 69 | your ticket please |
70 | END OF THE LINE | 70 | END OF THE LINE |
71 | End division loop | 71 | End division loop |
72 | 72 | ||
@@ -74,7 +74,7 @@ ALL ABOARD | |||
74 | your ticket please choo | 74 | your ticket please choo |
75 | choo | 75 | choo |
76 | choo | 76 | choo |
77 | tickets please chugga your ticket please chug | 77 | tickets please chugga your ticket please chug |
78 | END OF THE LINE | 78 | END OF THE LINE |
79 | End skip loop; zero former divisor and reuse space for a flag | 79 | End skip loop; zero former divisor and reuse space for a flag |
80 | 80 | ||
@@ -82,16 +82,16 @@ ALL ABOARD | |||
82 | choo | 82 | choo |
83 | chugga chugga tickets please chugga tickets please choo choo | 83 | chugga chugga tickets please chugga tickets please choo choo |
84 | chugga choo | 84 | chugga choo |
85 | chug chug chug | 85 | chug chug chug |
86 | tickets please chugga your ticket please your ticket please your ticket please | 86 | tickets please chugga your ticket please your ticket please your ticket please |
87 | choo choo | 87 | choo choo |
88 | tickets please | 88 | tickets please |
89 | END OF THE LINE | 89 | END OF THE LINE |
90 | Zero that flag unless quotient was 2 or 3; zero quotient; check flag | 90 | Zero that flag unless quotient was 2 or 3; zero quotient; check flag |
91 | 91 | ||
92 | ALL ABOARD | 92 | ALL ABOARD |
93 | chug chug chug chug chug chug chug chug chug chug chug chug choo choo | 93 | chug chug chug chug chug chug chug chug chug chug chug chug choo choo |
94 | tickets please | 94 | tickets please |
95 | 95 | ||
96 | END OF THE LINE | 96 | END OF THE LINE |
97 | If flag then set up divisor (13) for second division loop | 97 | If flag then set up divisor (13) for second division loop |
@@ -102,7 +102,7 @@ choo | |||
102 | chugga tickets please choo | 102 | chugga tickets please choo |
103 | chug choo | 103 | chug choo |
104 | choo | 104 | choo |
105 | your ticket please | 105 | your ticket please |
106 | END OF THE LINE | 106 | END OF THE LINE |
107 | Reduce divisor; Normal case: increase remainder | 107 | Reduce divisor; Normal case: increase remainder |
108 | 108 | ||
@@ -111,10 +111,10 @@ choo | |||
111 | tickets please chug tickets please choo choo | 111 | tickets please chug tickets please choo choo |
112 | chug choo | 112 | chug choo |
113 | chugga your ticket please choo | 113 | chugga your ticket please choo |
114 | chug | 114 | chug |
115 | choo | 115 | choo |
116 | choo | 116 | choo |
117 | your ticket please | 117 | your ticket please |
118 | END OF THE LINE | 118 | END OF THE LINE |
119 | Special case: increase remainder / move it back to divisor / increase quotient | 119 | Special case: increase remainder / move it back to divisor / increase quotient |
120 | 120 | ||
@@ -124,12 +124,12 @@ choo choo | |||
124 | choo choo | 124 | choo choo |
125 | choo choo | 125 | choo choo |
126 | choo choo | 126 | choo choo |
127 | chugga | 127 | chugga |
128 | END OF THE LINE | 128 | END OF THE LINE |
129 | Decrease dividend | 129 | Decrease dividend |
130 | 130 | ||
131 | ALL ABOARD | 131 | ALL ABOARD |
132 | your ticket please | 132 | your ticket please |
133 | END OF THE LINE | 133 | END OF THE LINE |
134 | End division loop | 134 | End division loop |
135 | 135 | ||
@@ -138,18 +138,18 @@ choo | |||
138 | choo | 138 | choo |
139 | tickets please choo choo | 139 | tickets please choo choo |
140 | chug choo | 140 | chug choo |
141 | chugga your ticket please | 141 | chugga your ticket please |
142 | END OF THE LINE | 142 | END OF THE LINE |
143 | Add remainder back to divisor to get a useful 13 | 143 | Add remainder back to divisor to get a useful 13 |
144 | 144 | ||
145 | ALL ABOARD | 145 | ALL ABOARD |
146 | choo | 146 | choo |
147 | tickets please | 147 | tickets please |
148 | END OF THE LINE | 148 | END OF THE LINE |
149 | Skip forward if quotient was 0 | 149 | Skip forward if quotient was 0 |
150 | 150 | ||
151 | ALL ABOARD | 151 | ALL ABOARD |
152 | chugga tickets please | 152 | chugga tickets please |
153 | END OF THE LINE | 153 | END OF THE LINE |
154 | Decrement quotient and skip forward if quotient was 1 | 154 | Decrement quotient and skip forward if quotient was 1 |
155 | 155 | ||
@@ -182,34 +182,34 @@ tickets please choo choo | |||
182 | choo choo | 182 | choo choo |
183 | chug choo | 183 | chug choo |
184 | choo | 184 | choo |
185 | chugga your ticket please | 185 | chugga your ticket please |
186 | END OF THE LINE | 186 | END OF THE LINE |
187 | Zero divisor and add 13 to copy if quotient was 0 | 187 | Zero divisor and add 13 to copy if quotient was 0 |
188 | 188 | ||
189 | ALL ABOARD | 189 | ALL ABOARD |
190 | your ticket please | 190 | your ticket please |
191 | END OF THE LINE | 191 | END OF THE LINE |
192 | End outer skip loop (jump to here if ((character minus 1)/32) was not 2 or 3) | 192 | End outer skip loop (jump to here if ((character minus 1)/32) was not 2 or 3) |
193 | 193 | ||
194 | ALL ABOARD | 194 | ALL ABOARD |
195 | choo choo | 195 | choo choo |
196 | tickets please chugga your ticket please | 196 | tickets please chugga your ticket please |
197 | END OF THE LINE | 197 | END OF THE LINE |
198 | Clear remainder from first division if second division was skipped | 198 | Clear remainder from first division if second division was skipped |
199 | 199 | ||
200 | ALL ABOARD | 200 | ALL ABOARD |
201 | choo choo | 201 | choo choo |
202 | click tickets please chugga your ticket please | 202 | click tickets please chugga your ticket please |
203 | END OF THE LINE | 203 | END OF THE LINE |
204 | Output ROT13ed character from copy and clear it | 204 | Output ROT13ed character from copy and clear it |
205 | 205 | ||
206 | ALL ABOARD | 206 | ALL ABOARD |
207 | choo choo | 207 | choo choo |
208 | chugga clack chug | 208 | chugga clack chug |
209 | END OF THE LINE | 209 | END OF THE LINE |
210 | Read next character | 210 | Read next character |
211 | 211 | ||
212 | ALL ABOARD | 212 | ALL ABOARD |
213 | your ticket please | 213 | your ticket please |
214 | END OF THE LINE | 214 | END OF THE LINE |
215 | End character reading loop | 215 | End character reading loop |