diff options
author | Case Duckworth | 2022-06-29 00:59:59 -0500 |
---|---|---|
committer | Case Duckworth | 2022-06-29 00:59:59 -0500 |
commit | 0a78720644e45bd27c4a57cbddf2d32aacb555c3 (patch) | |
tree | 29783dc9a534dbbfe172d5c84e66f5efcd9c43dc /examples/helloworld.trainfuck | |
parent | Recognize bf comments (diff) | |
download | trainfuck-0a78720644e45bd27c4a57cbddf2d32aacb555c3.tar.gz trainfuck-0a78720644e45bd27c4a57cbddf2d32aacb555c3.zip |
Probably version ... whatever the next higher one is
Diffstat (limited to 'examples/helloworld.trainfuck')
-rw-r--r-- | examples/helloworld.trainfuck | 152 |
1 files changed, 0 insertions, 152 deletions
diff --git a/examples/helloworld.trainfuck b/examples/helloworld.trainfuck deleted file mode 100644 index 1f68f11..0000000 --- a/examples/helloworld.trainfuck +++ /dev/null | |||
@@ -1,152 +0,0 @@ | |||
1 | TRAINFUCK BABEEE | ||
2 | CHOO CHOO MUTHERFUCKER | ||
3 | |||
4 | This example adapted from https://en.wikipedia.org/wiki/Brainfuck | ||
5 | |||
6 | This program prints "Hello World!" and a newline to the screen, its | ||
7 | length is 106 active command characters. | ||
8 | |||
9 | The program doesn't start until we have ALL ABOARD on a line by itself, so | ||
10 | we've got one better than an initial comment loop. | ||
11 | |||
12 | This file was handwritten, but soon(TM) we'll have a fucktrain command, | ||
13 | that'll translate to trainfuck from brainfuck. | ||
14 | |||
15 | ALL ABOARD | ||
16 | chug chug chug chug chug chug chug chug | ||
17 | END OF THE LINE | ||
18 | Set Cell #0 to 8 | ||
19 | (Also note: you can have comments betwen END OF THE LINE and ALL ABOARD) | ||
20 | ALL ABOARD | ||
21 | tickets please | ||
22 | choo | ||
23 | chug chug chug chug | ||
24 | END OF THE LINE | ||
25 | Add 4 to Cell #1; this will always set Cell #1 to 4 | ||
26 | ALL ABOARD | ||
27 | tickets please | ||
28 | END OF THE LINE | ||
29 | as the cell will be cleared by the loop | ||
30 | ALL ABOARD | ||
31 | choo | ||
32 | chug chug | ||
33 | END OF THE LINE | ||
34 | Add 2 to Cell #2 | ||
35 | ALL ABOARD | ||
36 | choo | ||
37 | chug chug chug | ||
38 | END OF THE LINE | ||
39 | Add 3 to Cell #3 | ||
40 | ALL ABOARD | ||
41 | choo | ||
42 | chug chug chug | ||
43 | END OF THE LINE | ||
44 | Add 3 to Cell #4 | ||
45 | ALL ABOARD | ||
46 | choo | ||
47 | chug | ||
48 | END OF THE LINE | ||
49 | Add 1 to Cell #5 | ||
50 | ALL ABOARD | ||
51 | choo choo | ||
52 | choo choo | ||
53 | choo choo | ||
54 | choo choo | ||
55 | chugga | ||
56 | END OF THE LINE | ||
57 | Decrement the loop counter in Cell #1 | ||
58 | ALL ABOARD | ||
59 | your ticket please | ||
60 | END OF THE LINE | ||
61 | Loop till Cell #1 is zero; number of iterations is 4 | ||
62 | ALL ABOARD | ||
63 | choo | ||
64 | chug | ||
65 | END OF THE LINE | ||
66 | Add 1 to Cell #2 | ||
67 | ALL ABOARD | ||
68 | choo | ||
69 | chug | ||
70 | END OF THE LINE | ||
71 | Add 1 to Cell #3 | ||
72 | ALL ABOARD | ||
73 | choo | ||
74 | chugga | ||
75 | END OF THE LINE | ||
76 | Subtract 1 from Cell #4 | ||
77 | ALL ABOARD | ||
78 | choo | ||
79 | choo | ||
80 | chug | ||
81 | END OF THE LINE | ||
82 | Add 1 to Cell #6 | ||
83 | ALL ABOARD | ||
84 | tickets pleasechoo choo | ||
85 | your ticket please | ||
86 | END OF THE LINE | ||
87 | Move back to the first zero cell you find; this will | ||
88 | ALL ABOARD | ||
89 | |||
90 | END OF THE LINE | ||
91 | be Cell #1 which was cleared by the previous loop | ||
92 | ALL ABOARD | ||
93 | choo choo | ||
94 | chugga | ||
95 | END OF THE LINE | ||
96 | Decrement the loop Counter in Cell #0 | ||
97 | ALL ABOARD | ||
98 | your ticket please | ||
99 | END OF THE LINE | ||
100 | Loop till Cell #0 is zero; number of iterations is 8 | ||
101 | ALL ABOARD | ||
102 | END OF THE LINE | ||
103 | The result of this is: | ||
104 | Cell No : 0 1 2 3 4 5 6 | ||
105 | Contents: 0 0 72 104 88 32 8 | ||
106 | Pointer : ^ | ||
107 | |||
108 | ALL ABOARD | ||
109 | choo | ||
110 | choo | ||
111 | click | ||
112 | END OF THE LINE | ||
113 | Cell #2 has value 72 which is 'H' | ||
114 | ALL ABOARD | ||
115 | choo | ||
116 | chugga chugga chugga click | ||
117 | END OF THE LINE | ||
118 | Subtract 3 from Cell #3 to get 101 which is 'e' | ||
119 | ALL ABOARD | ||
120 | chug chug chug chug chug chug chug click click chug chug chug click | ||
121 | END OF THE LINE | ||
122 | Likewise for 'llo' from Cell #3 | ||
123 | ALL ABOARD | ||
124 | choo | ||
125 | choo | ||
126 | click | ||
127 | END OF THE LINE | ||
128 | Cell #5 is 32 for the space | ||
129 | ALL ABOARD | ||
130 | choo choo | ||
131 | chugga click | ||
132 | END OF THE LINE | ||
133 | Subtract 1 from Cell #4 for 87 to give a 'W' | ||
134 | ALL ABOARD | ||
135 | choo choo | ||
136 | click | ||
137 | END OF THE LINE | ||
138 | Cell #3 was set to 'o' from the end of 'Hello' | ||
139 | ALL ABOARD | ||
140 | chug chug chug click chugga chugga chugga chugga chugga chugga click chugga chugga chugga chugga chugga chugga chugga chugga click | ||
141 | END OF THE LINE | ||
142 | Cell #3 for 'rl' and 'd' | ||
143 | ALL ABOARD | ||
144 | choo | ||
145 | choo | ||
146 | chug click | ||
147 | END OF THE LINE | ||
148 | Add 1 to Cell #5 gives us an exclamation point | ||
149 | ALL ABOARD | ||
150 | choo | ||
151 | chug chug click | ||
152 | END OF THE LINE | ||