1 ##########################
3 ### Severely updated version!
4 ### (now says "1 bottle" and
5 ### contains no extra "0" verse)
7 ##########################
8 ### 99 Bottles of Beer ###
9 ### coded in Brainfuck ###
10 ### with explanations ###
11 ##########################
13 # This Bottles of Beer program
14 # was written by Andrew Paczkowski
15 # Coder Alias: thepacz
16 # three_halves_plus_one@yahoo.com
19 > 0 in the zeroth cell
20 +++++++>++++++++++[<+++++>-] 57 in the first cell or "9"
21 +++++++>++++++++++[<+++++>-] 57 in second cell or "9"
22 ++++++++++ 10 in third cell
23 >+++++++++ 9 in fourth cell
25 ##########################################
26 ### create ASCII chars in higher cells ###
27 ##########################################
29 >>++++++++[<++++>-] " "
30 >++++++++++++++[<+++++++>-] b
31 +>+++++++++++[<++++++++++>-] o
32 ++>+++++++++++++++++++[<++++++>-] t
33 ++>+++++++++++++++++++[<++++++>-] t
34 >++++++++++++[<+++++++++>-] l
35 +>++++++++++[<++++++++++>-] e
36 +>+++++++++++++++++++[<++++++>-] s
37 >++++++++[<++++>-] " "
38 +>+++++++++++[<++++++++++>-] o
39 ++>++++++++++[<++++++++++>-] f
40 >++++++++[<++++>-] " "
41 >++++++++++++++[<+++++++>-] b
42 +>++++++++++[<++++++++++>-] e
43 +>++++++++++[<++++++++++>-] e
44 >+++++++++++++++++++[<++++++>-] r
45 >++++++++[<++++>-] " "
46 +>+++++++++++[<++++++++++>-] o
47 >+++++++++++[<++++++++++>-] n
48 >++++++++[<++++>-] " "
49 ++>+++++++++++++++++++[<++++++>-] t
50 ++++>++++++++++[<++++++++++>-] h
51 +>++++++++++[<++++++++++>-] e
52 >++++++++[<++++>-] " "
53 ++>+++++++++++++[<+++++++++>-] w
54 +>++++++++++++[<++++++++>-] a
55 >++++++++++++[<+++++++++>-] l
56 >++++++++++++[<+++++++++>-] l
58 ++>+++++++++++++++++++[<++++++>-] t
59 +>++++++++++++[<++++++++>-] a
60 +++>+++++++++++++[<++++++++>-] k
61 +>++++++++++[<++++++++++>-] e
62 >++++++++[<++++>-] " "
63 +>+++++++++++[<++++++++++>-] o
64 >+++++++++++[<++++++++++>-] n
65 +>++++++++++[<++++++++++>-] e
66 >++++++++[<++++>-] " "
67 >++++++++++[<++++++++++>-] d
68 +>+++++++++++[<++++++++++>-] o
69 ++>+++++++++++++[<+++++++++>-] w
70 >+++++++++++[<++++++++++>-] n
71 >++++++++[<++++>-] " "
72 +>++++++++++++[<++++++++>-] a
73 >+++++++++++[<++++++++++>-] n
74 >++++++++++[<++++++++++>-] d
75 >++++++++[<++++>-] " "
76 ++>+++++++++++[<++++++++++>-] p
77 +>++++++++++++[<++++++++>-] a
78 +>+++++++++++++++++++[<++++++>-] s
79 +>+++++++++++++++++++[<++++++>-] s
80 >++++++++[<++++>-] " "
81 +>+++++++++++++[<++++++++>-] i
82 ++>+++++++++++++++++++[<++++++>-] t
83 >++++++++[<++++>-] " "
84 +>++++++++++++[<++++++++>-] a
85 >+++++++++++++++++++[<++++++>-] r
86 +>+++++++++++[<++++++++++>-] o
87 >+++++++++++++[<+++++++++>-] u
88 >+++++++++++[<++++++++++>-] n
89 >++++++++++[<++++++++++>-] d
93 [<]>>>> go back to fourth cell
95 #################################
96 ### initiate the display loop ###
97 #################################
102 [>]<< go to last cell and back to LF
104 [<]> go to first cell
106 ###################################
107 #### begin display of characters###
108 ###################################
110 #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
111 #X X b o t t l e s o f b e e r
112 #.>.>.>.>.>.>.>.>.>.>.>.
114 #[<]> go to first cell
115 #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>>>>>>>>>>>>>.>
116 #X X b o t t l e s o f b e e r N
117 #.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
118 #t a k e o n e d o w n a n d p a s s
124 - subtract 1 from cell 2
127 ########################
128 ### display last line ##
129 ########################
131 #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
132 #X X b o t t l e s o f b e e r
133 #.>.>.>.>.>.>.>.>.>.>.
137 [<]>>>- go to cell 3/subtract 1
138 ] end loop when cell 3 is 0
139 ++++++++++ add 10 to cell 3
140 <++++++++++ back to cell 2/add 10
141 <- back to cell 1/subtract 1
142 [>]<. go to last line/carriage return
143 [<]> go to first line
145 ########################
146 ### correct last line ##
147 ########################
149 #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
150 #X X b o t t l e s o f b e e r
151 #.>.>.>.>.>.>.>.>.>.>.
155 [<]>>>>- go to cell 4/subtract 1
156 ] end loop when cell 4 is 0
158 ##############################################################
159 ### By this point verses 9910 are displayed but to work ###
160 ### with the lower numbered verses in a more readable way ###
161 ### we initiate a new loop for verses 9{CODE} that will not ###
162 ### use the fourth cell at all ###
163 ##############################################################
165 + add 1 to cell four (to keep it nonzero)
166 <-- back to cell 3/subtract 2
169 [>]<< go to last cell and back to LF
171 [<]> go to first cell
173 ###################################
174 #### begin display of characters###
175 ###################################
177 #>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
178 # X b o t t l e s o f b e e r
179 #.>.>.>.>.>.>.>.>.>.>.>.
181 #[<]> go to first cell
182 #>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>>>>>>>>>>>>>.>
183 # X b o t t l e s o f b e e r N
184 #.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
185 #t a k e o n e d o w n a n d p a s s
191 - subtract 1 from cell 2
193 ########################
194 ### display last line ##
195 ########################
197 #.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
198 #X b o t t l e s o f b e e r
199 #.>.>.>.>.>.>.>.>.>.>.
203 [<]>>>- go to cell 3/subtract 1
204 ] end loop when cell 3 is 0
205 + add 1 to cell 3 to keep it nonzero
207 [>]<. go to last line/carriage return
208 [<]> go to first line
210 ########################
211 ### correct last line ##
212 ########################
214 #>.>>>.>.>.>.>.>.>.>>.>.>.>.>.>.>.>.>.>
215 # X b o t t l e o f b e e r
216 #.>.>.>.>.>.>.>.>.>.>.<<<<.
220 [>]<< go to last cell and back to LF
222 [<]> go to first line
224 #########################
225 ### the final verse ##
226 #########################
228 #>.>>>.>.>.>.>.>.>.>>.>.>.>.>.>.>.>.>.>
229 # X b o t t l e o f b e e r
230 #.>.>.>.>.>.>.>.>.>.>.>.
232 #[<]> go to first cell
233 #>.>>>.>.>.>.>.>.>.>>.>.>.>.>.>.>.>.>>>>>>>>>>>>>.>
234 # X b o t t l e o f b e e r N
235 #.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
236 #t a k e o n e d o w n a n d p a s s
239 #[>]< go to last line
242 #[<]>>>> go to fourth cell
243 #>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>
244 # b o t t l e s o f b e e r
245 #.>.>.>.>.>.>.>.>.>.>.>.