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