Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
85 lines (84 sloc) 1.61 KB
; 99 bottles of beer in 755 instructions
; Author: Mike Tryczak (aka primo)
;
; Canonical codegolf version
; byte sequence
; \n _ _ _ _ c \n comma space d o t l G T
>++++++++++>>>-->
+>----->--->---->+>++>++>++>->
++[++++[>++++++++++++++<-]<++]
>>>---->>++++>>->++>----[<++<]
c = 0
n = 100
>
while(n)
[
n = n minus 1
-<<
N = str(n)
; first time \n _ becomes 9 9
++++++[<++++++++>-]<[<[<]>[->]<]
+<[>-]>[-<++++++++++<->>>]
++++++[<-------->-]<[<[<]>[+>]<]
<->>>
if(c)
[
>
if(n)
[
'Take one down and'
[>]<.<<<<<---.>>>-.<<<++++.<.>>.-.<.<.>-.>+.>+++.<-.<<.>---.>.<+++.
' pass it around' comma space
<.>>++.<---.>>----..<<<.>>>>--.+++<+.<<<.>.>>--.<-.>+++.-<-.+<+++.<<.>.<<<<-<
]>
else
[
'Go to the store and'
[>]<<+.<<<.<<.>>>.<.<<.>>>.<<++++.---.<.>>>-.+.<.>--.<<.<.>----.>-.<+++.
' buy some more' comma space
<.>--.>>+++.++++.<<<.>>>------.<+.--.<+++.<.>>.++.>-.++<<.-<<.>.<<<<-
N = '9'
N
<<<+++++++++.>>>
]
<+>
]
c = c plus 2
<++
while(c)
[
N
<<[<]>[.>]>>>
' bottle'
>>>.>--.>.>..->.<<<+++.<<<<
if(n minus 1) 's'
-[>>>>>>.[<]]<[>]>+
' of beer'
>>>.>>.<+.<.>----.+++..->>-.++
<[<<]<-
if(c minus 1)
[
' on the wall'
>>>>>.>>.-.+<<.>>>.<<++++.---.<.>>>+++.---<<----.+++>>>..[<<]
]
<<[>]>-
if(c minus 2)
[
period newline
>>>>++.--<.<<<+
if(c minus 1) newline
[>>>.<<<<]>[>]<-<
]>>
else
[
comma space
>>.>.<<<<
]
if(not n) c = c minus 2
>[<<++>]
c = c minus 1
<[>]<-
]
c = 1
>+>
]
You can’t perform that action at this time.