99BottlesOfBeer.bfk (7552B)
1 Programma che stampa il testo completo della canzone 99 bottles of beer 2 3 ########################## 4 ### 5 ### Severely updated version! 6 ### (now says "1 bottle" and 7 ### contains no extra "0" verse) 8 ### 9 ########################## 10 ### 99 Bottles of Beer ### 11 ### coded in Brainfuck ### 12 ### with explanations ### 13 ########################## 14 # 15 # This Bottles of Beer program 16 # was written by Andrew Paczkowski 17 # Coder Alias: thepacz 18 # three_halves_plus_one at yahoo dot com 19 ##### 20 21 > 0 in the zeroth cell 22 +++++++>++++++++++[<+++++>-] 57 in the first cell or "9" 23 +++++++>++++++++++[<+++++>-] 57 in second cell or "9" 24 ++++++++++ 10 in third cell 25 >+++++++++ 9 in fourth cell 26 27 ########################################## 28 ### create ASCII chars in higher cells ### 29 ########################################## 30 31 >>++++++++[<++++>-] " " 32 >++++++++++++++[<+++++++>-] b 33 +>+++++++++++[<++++++++++>-] o 34 ++>+++++++++++++++++++[<++++++>-] t 35 ++>+++++++++++++++++++[<++++++>-] t 36 >++++++++++++[<+++++++++>-] l 37 +>++++++++++[<++++++++++>-] e 38 +>+++++++++++++++++++[<++++++>-] s 39 >++++++++[<++++>-] " " 40 +>+++++++++++[<++++++++++>-] o 41 ++>++++++++++[<++++++++++>-] f 42 >++++++++[<++++>-] " " 43 >++++++++++++++[<+++++++>-] b 44 +>++++++++++[<++++++++++>-] e 45 +>++++++++++[<++++++++++>-] e 46 >+++++++++++++++++++[<++++++>-] r 47 >++++++++[<++++>-] " " 48 +>+++++++++++[<++++++++++>-] o 49 >+++++++++++[<++++++++++>-] n 50 >++++++++[<++++>-] " " 51 ++>+++++++++++++++++++[<++++++>-] t 52 ++++>++++++++++[<++++++++++>-] h 53 +>++++++++++[<++++++++++>-] e 54 >++++++++[<++++>-] " " 55 ++>+++++++++++++[<+++++++++>-] w 56 +>++++++++++++[<++++++++>-] a 57 >++++++++++++[<+++++++++>-] l 58 >++++++++++++[<+++++++++>-] l 59 >+++++[<++>-] LF 60 ++>+++++++++++++++++++[<++++++>-] t 61 +>++++++++++++[<++++++++>-] a 62 +++>+++++++++++++[<++++++++>-] k 63 +>++++++++++[<++++++++++>-] e 64 >++++++++[<++++>-] " " 65 +>+++++++++++[<++++++++++>-] o 66 >+++++++++++[<++++++++++>-] n 67 +>++++++++++[<++++++++++>-] e 68 >++++++++[<++++>-] " " 69 >++++++++++[<++++++++++>-] d 70 +>+++++++++++[<++++++++++>-] o 71 ++>+++++++++++++[<+++++++++>-] w 72 >+++++++++++[<++++++++++>-] n 73 >++++++++[<++++>-] " " 74 +>++++++++++++[<++++++++>-] a 75 >+++++++++++[<++++++++++>-] n 76 >++++++++++[<++++++++++>-] d 77 >++++++++[<++++>-] " " 78 ++>+++++++++++[<++++++++++>-] p 79 +>++++++++++++[<++++++++>-] a 80 +>+++++++++++++++++++[<++++++>-] s 81 +>+++++++++++++++++++[<++++++>-] s 82 >++++++++[<++++>-] " " 83 +>+++++++++++++[<++++++++>-] i 84 ++>+++++++++++++++++++[<++++++>-] t 85 >++++++++[<++++>-] " " 86 +>++++++++++++[<++++++++>-] a 87 >+++++++++++++++++++[<++++++>-] r 88 +>+++++++++++[<++++++++++>-] o 89 >+++++++++++++[<+++++++++>-] u 90 >+++++++++++[<++++++++++>-] n 91 >++++++++++[<++++++++++>-] d 92 >+++++[<++>-] LF 93 +++++++++++++ CR 94 95 [<]>>>> go back to fourth cell 96 97 ################################# 98 ### initiate the display loop ### 99 ################################# 100 101 [ loop 102 < back to cell 3 103 [ loop 104 [>]<< go to last cell and back to LF 105 .. output 2 newlines 106 [<]> go to first cell 107 108 ################################### 109 #### begin display of characters### 110 ################################### 111 # 112 #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 113 #X X b o t t l e s o f b e e r 114 #.>.>.>.>.>.>.>.>.>.>.>. 115 #o n t h e w a l l N 116 #[<]> go to first cell 117 #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>>>>>>>>>>>>>.> 118 #X X b o t t l e s o f b e e r N 119 #.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 120 #t a k e o n e d o w n a n d p a s s 121 #.>.>.>.>.>.>.>.>.>. 122 #i t a r o u n d N 123 ##### 124 125 [<]>> go to cell 2 126 - subtract 1 from cell 2 127 < go to cell 1 128 129 ######################## 130 ### display last line ## 131 ######################## 132 # 133 #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 134 #X X b o t t l e s o f b e e r 135 #.>.>.>.>.>.>.>.>.>.>. 136 #o n t h e w a l l 137 ##### 138 139 [<]>>>- go to cell 3/subtract 1 140 ] end loop when cell 3 is 0 141 ++++++++++ add 10 to cell 3 142 <++++++++++ back to cell 2/add 10 143 <- back to cell 1/subtract 1 144 [>]<. go to last line/carriage return 145 [<]> go to first line 146 147 ######################## 148 ### correct last line ## 149 ######################## 150 # 151 #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 152 #X X b o t t l e s o f b e e r 153 #.>.>.>.>.>.>.>.>.>.>. 154 #o n t h e w a l l 155 ##### 156 157 [<]>>>>- go to cell 4/subtract 1 158 ] end loop when cell 4 is 0 159 160 ############################################################## 161 ### By this point verses 99\10 are displayed but to work ### 162 ### with the lower numbered verses in a more readable way ### 163 ### we initiate a new loop for verses 9{CODE} that will not ### 164 ### use the fourth cell at all ### 165 ############################################################## 166 167 + add 1 to cell four (to keep it non\zero) 168 <-- back to cell 3/subtract 2 169 170 [ loop 171 [>]<< go to last cell and back to LF 172 .. output 2 newlines 173 [<]> go to first cell 174 175 ################################### 176 #### begin display of characters### 177 ################################### 178 # 179 #>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 180 # X b o t t l e s o f b e e r 181 #.>.>.>.>.>.>.>.>.>.>.>. 182 #o n t h e w a l l N 183 #[<]> go to first cell 184 #>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>>>>>>>>>>>>>.> 185 # X b o t t l e s o f b e e r N 186 #.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 187 #t a k e o n e d o w n a n d p a s s 188 #.>.>.>.>.>.>.>.>.>. 189 #i t a r o u n d N 190 ##### 191 192 [<]>> go to cell 2 193 - subtract 1 from cell 2 194 195 ######################## 196 ### display last line ## 197 ######################## 198 # 199 #.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 200 #X b o t t l e s o f b e e r 201 #.>.>.>.>.>.>.>.>.>.>. 202 #o n t h e w a l l 203 ##### 204 205 [<]>>>- go to cell 3/subtract 1 206 ] end loop when cell 3 is 0 207 + add 1 to cell 3 to keep it non\zero 208 209 [>]<. go to last line/carriage return 210 [<]> go to first line 211 212 ######################## 213 ### correct last line ## 214 ######################## 215 # 216 #>.>>>.>.>.>.>.>.>.>>.>.>.>.>.>.>.>.>.> 217 # X b o t t l e o f b e e r 218 #.>.>.>.>.>.>.>.>.>.>.<<<<. 219 #o n t h e w a l l 220 ##### 221 222 [>]<< go to last cell and back to LF 223 .. output 2 newlines 224 [<]> go to first line 225 226 ######################### 227 ### the final verse ## 228 ######################### 229 # 230 #>.>>>.>.>.>.>.>.>.>>.>.>.>.>.>.>.>.>.> 231 # X b o t t l e o f b e e r 232 #.>.>.>.>.>.>.>.>.>.>.>. 233 #o n t h e w a l l N 234 #[<]> go to first cell 235 #>.>>>.>.>.>.>.>.>.>>.>.>.>.>.>.>.>.>>>>>>>>>>>>>.> 236 # X b o t t l e o f b e e r N 237 #.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 238 #t a k e o n e d o w n a n d p a s s 239 #.>.>.>.>.>.>.>.>.>. 240 #i t a r o u n d N 241 #[>]< go to last line 242 #<<<.<<.<<<. 243 # n o 244 #[<]>>>> go to fourth cell 245 #>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 246 # b o t t l e s o f b e e r 247 #.>.>.>.>.>.>.>.>.>.>.>. 248 #o n t h e w a l l N 249 #####fin##