55
\$\begingroup\$

Challenge

Write a program that outputs the lyrics to 99 Bottles of Beer, but instead of "beer", output "fizz" if the number of bottles on the wall is a multiple of 3, "buzz" if it is a multiple of 5, and "fizzbuzz" if it is a multiple of 3 and a multiple of 5. If the number of bottles on the wall is not a multiple of 3 or 5, just output "beer" as usual.

Lyrics

99 bottles of fizz on the wall, 99 bottles of fizz.
Take one down and pass it around, 98 bottles of beer on the wall.

98 bottles of beer on the wall, 98 bottles of beer.
Take one down and pass it around, 97 bottles of beer on the wall.

97 bottles of beer on the wall, 97 bottles of beer.
Take one down and pass it around, 96 bottles of fizz on the wall.

96 bottles of fizz on the wall, 96 bottles of fizz.
Take one down and pass it around, 95 bottles of buzz on the wall.

95 bottles of buzz on the wall, 95 bottles of buzz.
Take one down and pass it around, 94 bottles of beer on the wall.

....

3 bottles of fizz on the wall, 3 bottles of fizz.
Take one down and pass it around, 2 bottles of beer on the wall.

2 bottles of beer on the wall, 2 bottles of beer.
Take one down and pass it around, 1 bottle of beer on the wall.

1 bottle of beer on the wall, 1 bottle of beer.
Go to the store and buy some more, 99 bottles of fizz on the wall.


This is , so the shortest submission in each language wins.

\$\endgroup\$
  • 30
    \$\begingroup\$ I have 95 bottles of fizz. I take one away. Now I have 94 bottles of beer. Logic. \$\endgroup\$ – Okx May 12 '17 at 19:10
  • 2
    \$\begingroup\$ Can I have a bottle of fizzbeer? \$\endgroup\$ – Stephen May 12 '17 at 19:15
  • 1
    \$\begingroup\$ Is there supposed to be a newline after the 3rd bottle? \$\endgroup\$ – Kritixi Lithos May 12 '17 at 19:29
  • 2
    \$\begingroup\$ Is a newline required between the two lines? Before Kritixi Lithos's edit there were none and now there are. \$\endgroup\$ – dzaima May 12 '17 at 19:36
  • 11
    \$\begingroup\$ @Okx Well, beer is fizzy and gives you a buzz... \$\endgroup\$ – Draco18s May 12 '17 at 22:09

16 Answers 16

12
\$\begingroup\$

Python 2, 263 253 245 bytes

i=99
x=''
while i:x+=', %s on the wall.\n\n%s on the wall, %s.\n'%(('%d bottle%s of %s'%(i,'s'*(i>1),(i%3<1)*'fizz'+(i%5<1)*'buzz'or'beer'),)*3)+'GToa kteo  otnhee  dsotwonr ea nadn dp absusy  isto maer omuonrde'[i>1::2];i-=1
print x[35:]+x[:33]

Try it online!

\$\endgroup\$
  • \$\begingroup\$ This is awesome! Can you explain why interpolating the strings is the shortest option? \$\endgroup\$ – musicman523 May 13 '17 at 2:23
  • 2
    \$\begingroup\$ For example ['ab','cd'][x] can be rewritten as 'acbd'[x::2], just to save some bytes \$\endgroup\$ – Rod May 13 '17 at 4:01
7
\$\begingroup\$

C (GCC), 276 274 bytes

Thanks to Neil for saving two bytes!

#define w" on the wall"
#define c(i)printf("%d bottle%s of %s",i,"s"+!~-i,i%3?i%5?"beer":"buzz":i%5?"fizz":"fizzbuzz"),printf(
i;f(){for(i=99;i;c((i?:99))w".\n\n"))c(i)w", "),c(i)".\n"),printf(--i?"Take one down and pass it around, ":"Go to the store and buy some more, ");}

Who doesn't love unmatched parentheses in macro expansions ?

Ungolfed:

#define c(i)                               \
    printf(                                \
        "%d bottle%s of %s",               \
        i,                   /* Number  */ \
        i-1 ? "s" : "",      /* Plural  */ \
        i % 3                /* FizzBuzz*/ \
            ? i % 5                        \
                ? "beer"                   \
                : "buzz"                   \
            : i % 5                        \
                ? "fizz"                   \
                : "fizzbuzz"               \
    )

i;
f() {
    for(i = 99; i; ) {
        c(i); printf(" on the wall, ");
        c(i); printf(".\n");
        printf(
            --i
                ? "Take one down and pass it around, "
                : "Go to the store and buy some more, "
        );

        // This has been stuffed into the for increment
        c((i?:99)); printf(" on the wall.\n\n");
    }
}

See it live on Coliru!

Alternate version (276 bytes)

#define c(i)printf("%d bottle%s of %s",i,i-1?"s":"",i%3?i%5?"beer":"buzz":i%5?"fizz":"fizzbuzz"),printf(
i,*w=" on the wall";f(){for(i=99;i;c((i?:99))"%s.\n\n",w))c(i)"%s, ",w),c(i)".\n"),printf(--i?"Take one down and pass it around, ":"Go to the store and buy some more, ");}
\$\endgroup\$
  • \$\begingroup\$ This is super cool! I'm always shocked at how good C answers can be with string manipulation. \$\endgroup\$ – musicman523 May 13 '17 at 2:24
  • \$\begingroup\$ Save a few bytes by changing #define w" on the wall" to *w=" on the wall". \$\endgroup\$ – MD XF May 14 '17 at 0:38
  • \$\begingroup\$ @MDXF mmh, I get the exact same byte count. Am I missing something? \$\endgroup\$ – Quentin May 14 '17 at 11:48
  • \$\begingroup\$ I think they meant you can replace #define w with *w= to save bytes there. Honestly I'm not all that familiar with golfed C, but my guess is that it makes w an implicitly-defined global char*. \$\endgroup\$ – musicman523 May 14 '17 at 15:59
  • 4
    \$\begingroup\$ @musicman523 the issue is that the #defined w is a string literal, which is automatically pasted with adjacent string literals. If w is a variable, I have to use actual string formatting inside printf. \$\endgroup\$ – Quentin May 14 '17 at 16:07
6
\$\begingroup\$

Röda, 273 bytes

f{a=`bottle`f=` on the wall`g=`99 ${a}s of fizz`;[`$g$f, $g.
`];seq 98,1|{|b|d=`s`d=``if[b=1];c=``c=`fizz`if[b%3=0];c.=`buzz`if[b%5=0];c=`beer`if[c=``];e=`$b $a$d of $c`;[`Take one down and pass it around, $e$f.

$e$f, $e.
`]}_;[`Go to the store and buy some more, $g$f.`]}

Try it online!

Will golf further in the morning.

\$\endgroup\$
6
\$\begingroup\$

PHP, 242 Bytes

function f($k){return"$k bottle".(s[$k<2])." of ".([fizz][$k%3].[buzz][$k%5]?:beer);}$w=" on the wall";for($b=f($c=99);$c;)echo"$b$w, $b.
",--$c?"Take one down and pass it around":"Go to the store and buy some more",", ",$b=f($c?:99),"$w.

";

Try it online!

PHP, 244 Bytes

for($e=s,$b=fizz,$c=99;$c;)echo strtr("301245, 30124.
6, 708295.

",[" bottle",$e," of ",$c,$b," on the wall",--$c?"Take one down and pass it around":"Go to the store and buy some more",$k=$c?:99,$e=s[2>$k],$b=[fizz][$k%3].[buzz][$k%5]?:beer]);

Try it online!

use function strtr

PHP, 245 Bytes

$f=function($k)use(&$b){$b="$k bottle".(s[$k<2])." of ".([fizz][$k%3].[buzz][$k%5]?:beer);};for($w=" on the wall",$f($c=99);$c;)echo"$b$w, $b.
",--$c?"Take one down and pass it around":"Go to the store and buy some more",", {$f($c?:99)}$b$w.

";

Try it online!

use an Anonymous function in the string to get a sustring depending of the integer

Expanded

$f=function($k)use(&$b){$b="$k bottle".(s[$k<2])." of ".([fizz][$k%3].[buzz][$k%5]?:beer);};
for($w=" on the wall",$f($c=99);$c;)
echo"$b$w, $b.
",--$c?"Take one down and pass it around":"Go to the store and buy some more"
,", {$f($c?:99)}$b$w.

";
\$\endgroup\$
  • 1
    \$\begingroup\$ If I didn't miscount you can save 2 bytes (250 bytes in total): function x($n){return"$n bottle".($n-1?s:'')." of ".(($n%3?'':fizz).($n%5?'':buzz)?:beer);}$y=" on the wall";for($b=99;$b;){$c=x($b);echo"$c$y, $c.↵",--$b?"Take one down and pass it around":"Go to the store and buy some more",", ".x($b?:99)."$y.↵↵";}. :) \$\endgroup\$ – insertusernamehere May 13 '17 at 14:13
  • 1
    \$\begingroup\$ @insertusernamehere You have miscount with a few changes it saves 2 Bytes more. Thank You. And you have give me a little idea to use use in combination with the anonymous function which saves 1 Byte in this version \$\endgroup\$ – Jörg Hülsermann May 13 '17 at 14:57
5
\$\begingroup\$

05AB1E, 151 146 143 bytes

99LRv'¬ž“fizzÒÖ“#y35SÖÏJ‚˜1(è©y“ƒ¶€µ„‹€ƒî倕…¡, ÿÏꀂ ÿ€‰€€íÒ.“ªõ®y“ÿÏꀂ ÿ€‰€€íÒ, “D#4£ðýs…ÿÿ.}‚‚˜'Ïê'±¥:`)¦¦¬#7£ðý¨“‚œ€„€€ƒï€ƒ‚¥€ä€£, ÿ.“ª)˜»

Try it online!

\$\endgroup\$
4
\$\begingroup\$

SOGL, 136 135 134 133 131 bytes

Ƨ, o▓k
"πFT+╔¡‘oW
³³q"'bμ⁸‘oH? so}5\;3\«+"ΞQv↑χāσκN⌡κYT¡‘_,S─‘oθwoX▓
MH∫}¹±{▓WkƧ.¶oH¡"sΗ─χpēGķ¶¾3Ζ^9f.⅟▒E┌Fρ_╬a→‘KΘw⁽oXH‽M}HkW">⁸‘p

First of all, the 3rd function:

                                    ▓  name this "▓" (example input: 15)                          [15]
³³                                     Create 4 extra copies of the top thing (number of things)  [15, 15, 15, 15, 15]
  q                                    output without popping one of them                         [15, 15, 15, 15, 15]
   "...‘o                              output " bottle"                                           [15, 15, 15, 15, 15]
         H?   }                        if pop-1 [isn't 0]                                         [15, 15, 15, 15]
            so                           output "s"                                               [15, 15, 15, 15]
               5\                      push if POP divides by 5                                   [15, 15, 15, 1]
                 ;                     swap [if divides & another number copy]                    [15, 15, 1, 15]
                  3\«                  push if POP divides by 3, multiplied by 2                  [15, 15, 1, 2]
                     +                 add those together                                         [15, 15, 3]
                      "...‘            push "buzz fizz fizzbuzz beer"                             [15, 15, 3, "buzz fizz fizzbuzz beer"]
                           ...‘o       output " of " (done over here to save a byte for a quote)  [15, 15, 3, "buzz fizz fizzbuzz beer"]
                                θ      split ["buzz fizz fizzbuzz beer"] on spaces                [15, 15, 3, ["buzz","fizz","fizzbuzz","beer"]]
                                 w     get the index (1-indexed, wrapping)                        [15, 15, ["buzz","fizz","fizzbuzz","beer"], "fizzbuzz"]
                                  o    output that string                                         [15, 15, ["buzz","fizz","fizzbuzz","beer"]]
                                   X   pop the array off of the stack                             [15, 15]

The first function:

Ƨ, o▓k
     k  name this "function" "k"
Ƨ, o    output ", "
    ▓   execute the "bottleify" function

The second function:

"πFT+╔¡‘oW
         W  call this "W"
"πFT+╔¡‘    push " on the wall"
        o   output it

And the main part:

MH∫}                                     repeat 99 times, each time pushing index
    ¹                                    wrap in an array
     ±                                   reverse it
      {                                  iterate over it
       ▓                                 execute that function
        W                                execute that function
         k                               execute that function
          Ƨ.¶o                           output ".\n"
              H¡                         push if POP-1 isn't 0 (aka 1 if pop <> 1, 0 if pop == 1)
                "...‘                    push "Stake one down and pass it aroundSgo to the store and buy some more"
                     K                   push the first letter of that string
                      Θ                  split ["take one down and pass it aroundSgo to the store and buy some more" with "S"]
                       w                 gets the xth (1-indexed, wrapping) item of that array
                        ⁽o               uppercase the 1st letter and output
                          X              pop the array off
                           H‽            if pop-1 [isn't 0]
                             M           push 100
                              }          ENDIF
                               H         decrease POP
                                k        execute that function
                                 W       execute that function
                                  ">⁸‘p  output ".\n\n"

Lost a couple bytes because of a bug that O puts a newline before and after it (And somehow this goes back to V0.9 (this is V0.11 code))

\$\endgroup\$
4
\$\begingroup\$

Java, 344 340 339 bytes

(-4 bytes after golfing fizzbuzz; -1 byte removing stray whitespace)

interface X{static void main(String[]a){for(int i=99;i>0;System.out.printf("%s on the wall, %s.%n%s, %s on the wall.%n%n",b(i),b(i--),i<1?"Go to the store and buy some more":"Take one down and pass it around",b(i<1?99:i)));}static String b(int i){return i+" bottle"+(i>1?"s":"")+" of "+(i%3<1?"fizz":"")+(i%5<1?"buzz":i%3<1?"":"beer");}}

Slightly ungolfed (using 1-space indentation to eliminate horizontal scrolling):

interface X {
 static void main(String[]a){
  for(int i=99;i>0;System.out.printf("%s on the wall, %s.%n%s, %s on the wall.%n%n",
   b(i),b(i--),
   i<1?"Go to the store and buy some more":"Take one down and pass it around",
   b(i<1?99:i)));
 }
 static String b(int i){
  return i+" bottle"+(i>1?"s":"")+" of "+(i%3<1?"fizz":"")+(i%5<1?"buzz":i%3<1?"":"beer");
 }
}
\$\endgroup\$
4
\$\begingroup\$

JavaScript (ES6), 316 309 bytes

This is a full program rather than a function. Nothing very creative, it's just the naive approach (hence the bytecount!). I am using console.log() instead of alert() because many browsers have limit on the number of chars that can be displayed using alert(). Note that all the whitespaces and newlines are necessary.

a="";for(i=99;i>0;i--){b=j=>"bottle"+(j>1?"s":"");d=a=>(a%3?"":"fizz")+(a%5?"":"buzz")||"beer");w=" on the wall";o=" of ";a+=`${i+" "+b(i)+o+d(i)+w+", "+i+" "+b(i)+o+d(i)}.
${i>1?"Take one down and pass it around, ":"Go to the store and buy some more, "}${(y=i-1?i-1:99)+" "+b(y)+o+d(y)+w}.

`;}console.log(a)

Ungolfed :

let accumulator = "";
for(let i = 99; i>0; i--){
    let bottleString = j => "bottle"+(j>1?"s":""),
    drink = a =>(a%3?"":"fizz")+(a%5?"":"buzz")||"beer",
    wallString = " on the wall",
    of=" of ";
    accumulator += `${i+" "+bottleString(i)+of+drink(i)+wallString+", "+i+" "+bottleString(i)+of+drink(i)}.
${i>1?"Take one down and pass it around, ":"Go to the store and buy some more, "}${(y=i-1?i-1:99)+" "+bottleString(y)+of+drink(y)+wallString}.

`;
}

console.log(accumulator);

Here's the Snippet :

a="";for(i=99;i>0;i--){b=j=>"bottle"+(j>1?"s":"");d=a=>(a%3?"":"fizz")+(a%5?"":"buzz")||"beer";w=" on the wall";o=" of ";a+=`${i+" "+b(i)+o+d(i)+w+", "+i+" "+b(i)+o+d(i)}.
${i>1?"Take one down and pass it around, ":"Go to the store and buy some more, "}${(y=i-1?i-1:99)+" "+b(y)+o+d(y)+w}.

`;}console.log(a)

BTW, with this answer, I have earned the bronze badge in ! Never thought I will accomplish this ever (not that it's a big achievement, though.)!

\$\endgroup\$
  • \$\begingroup\$ Your d function doesn't need any ()s because ?: is right-associative, but you can actually save even more bytes using d=a=>(a%3?"":"fizz")+(a%5?"":"buzz")||"beer". \$\endgroup\$ – Neil May 15 '17 at 20:52
3
\$\begingroup\$

Retina, 230 bytes


99$*_
_\B
Take one down and pass it around, $.'#.¶¶$.'#, $.'.¶
^
99#, 99.¶
_
Go to the store and buy some more, 99#.
#
 on the wall
1\b|(\d+)
$& bottle$#1$*s of $&$*_
\b(_{15})+\b
fizzbuzz
\b(_{5})+\b
buzz
\b(___)+\b
fizz
_+
beer

Try it online! Explanation:


99$*_

Inserts 99 _s.

_\B
Take one down and pass it around, $.'#.¶¶$.'#, $.'.¶

Changes all but the last _ to the string Take one down and pass it around, $.'#.¶¶$.'#, $.'.¶, where is a newline and $.' is the count of remaining underscores. This effectively counts back from 98 to 1.

^
99#, 99.¶

Adds the first line of the first verse in "compact" format.

_
Go to the store and buy some more, 99#.

Adds the second line of the last verse. Why I need jump through hoops to use the _ I don't know, but $ seems to match twice, so I can't use that. Go figure.

#
 on the wall

Substitutes a string which appears several times in the verse.

1\b|(\d+)
$& bottle$#1$*s of $&$*_

This matches the integers in the verses, and suffixes the appropriate bottle(s) of, and expands back to unary again, in preparation to choose the beverage. (I save 1 byte on on the 99s this way.)

\b(_{15})+\b
fizzbuzz
\b(_{5})+\b
buzz
\b(___)+\b
fizz
_+
beer

Replace exact multiples with the appropriate beverage.

\$\endgroup\$
2
\$\begingroup\$

sed, 468 459 456 bytes

s:^:99 bottles of fizz on the wall, 99 bottles of fizz.:
p
s:99:I8:g
s:fizz:XYYZ:g
x
s:^:Take one down and pass it around, I8 bottles of XYYZ on the wall.\n:
G
x
:
g
s:XXX:fizz:g
s:Y{5}:buzz:g
s:\bX*Y*Z:beer:g
s:[XYZ]::g
y:ABCDEFGHI:123456789:
s:\b0::g
/ 1 /bq
p
x
s:^::
tc
:c
s:(\S)0:\1@:g
Td
y:ABCDEFGHI:0ABCDEFGH:
:d
y:123456789@:0123456789:
s:(XXX)*(Y{5})*(Y*Z):XY\3:g
x
b
:q
s:es:e:g
aGo to the store and buy some more, 99 bottles of fizz on the wall.

Try it online!

Requires -r flag.

Explanation

Hold space holds the pattern of two repeating lines, with numbers represented as [A-I][0-9] (separate digits for tens and ones) and the kind of beverage represented as X*Y*Z, where X keeps track of -N mod 3, and Y of -N mod 5.

On each subsequent iteration, the numbers get decremented and the Xs and Ys get updated. Then hold space gets copied to the pattern space, turned into lines of the song, and printed.

\$\endgroup\$
2
\$\begingroup\$

C, 349 345 344 bytes

#define b(x)x^1?" bottles":" bottle"
#define g i-1?"Take one down and pass it around":"Go to the store and buy some more"
*w=" on the wall";*s(x){return x?x%15?x%5?x%3?"beer":"fizz":"buzz":"fizzbuzz":"fizz";}i=100;main(){while(--i){printf("%d%s of %s%s, %d%s of %s.\n%s, %d%s of %s%s.\n",i,b(i),s(i),w,i,b(i),s(i),g,i-1?i-1:99,b(i-1),s(i-1),w);}}

Well, there you go. That took an hour.

Try it online!

\$\endgroup\$
2
\$\begingroup\$

Javascript (ES6), 236 234 233 232 bytes

for(i=99;i;console.log(z()+`, ${z(_)}.
${--i?'Take one down and pass it around':'Go to the store and buy some more'}, ${z()}.

`))z=(o=' on the wall',j=i||99)=>j+` bottle${j>1?'s':_} of `+((j%3?_:'fizz')+(j%5?_='':'buzz')||'beer')+o

Demo

// replace console.log to avoid 50-log limit in snippets:
console.log=_=>document.write(`<pre>${_}</pre>`)

for(i=99;i;console.log(z()+`, ${z(_)}.
${--i?'Take one down and pass it around':'Go to the store and buy some more'}, ${z()}.

`))z=(o=' on the wall',j=i||99)=>j+` bottle${j>1?'s':_} of `+((j%3?_:'fizz')+(j%5?_='':'buzz')||'beer')+o

Ungolfed

i = 99  // start counter at 99

z = (   // define function z which takes arguments with defaults:
   o = ' on the wall', // o = defaults to ' on the wall'
   j = i || 99         // j = defaults to value of counter i - or 99 when i == 0
) => 
    j +                 // our current j counter
    ' bottle' +
    (j > 1 ? 's' : _) + // choose 's' when we have more than 1 bottle, or blank _
    (
        (j % 3 ? _ : 'fizz') +      // if j % 3 is 0, add 'fizz', otherwise blank _
        (j % 5 ? _ = '' : 'buzz')   // if j % 5 is 0, add 'buzz', otherwise blank _
                                    // _ gets defined here since it's the first place it's used
            ||                      // if no fizz or buzz, result is a falsey empty string
        'beer'                      // replace falsey value with 'beer'
    ) +
    o                               // append o

while (i) {         // while counter is non-zero
    console.log(    // output string:
        z() +       // call z without o argument
        ', ' +
        z(_) +      // call z with blank _ for o to block ' on the wall' here
        '.\n' +
        ( --i       // decrement i, if still non-zero:
            ? 'Take one down and pass it around'
                    // otherwise:
            : 'Go to the store and buy some more'
        ) + 
        ', ' +
        z() +       // another call to z without o
        '.\n\n'
    )
}
\$\endgroup\$
1
\$\begingroup\$

Ruby, 261 bytes

99.downto(1){|i|w=' on the wall'
f=->x{a='';x%3<1&&a+='fizz';x%5<1&&a+='buzz';a<?a&&a='beer';"%d bottle%s of %s"%[x,x<2?'':?s,a]}
puts [f[i]+w,f[i]+?.+$/+(i<2?'Take one down and pass it around':'Go to the store and buy some more'),f[i<2?99:i-1]+w+?.+$/*2]*', '}

Try it online!

\$\endgroup\$
1
\$\begingroup\$

shortC, 314 312 bytes

Db(x)x^1?" bottles":" bottle"
Dg i-1?"Take one down and pass it around":"Go to the store and buy some more"
*w=" on the wall";*s(x){Tx?x%15?x%5?x%3?"beer":"fizz":"buzz":"fizzbuzz":"fizz";}i=100;AW--i){R"%d%s of %s%s, %d%s of %s.\n%s, %d%s of %s%s.\n",i,b(i),s(i),w,i,b(i),s(i),g,i-1?i-1:99,b(i-1),s(i-1),w

Sorry there's no explanation, but I completely forgot how this works.

\$\endgroup\$
  • \$\begingroup\$ You should consider adding another answer in shortC that follows the logic of this answer, to see how it golfs. Also, it looks like in both your answers you only use your macro for g once, you should be able to inline it and save a few bytes \$\endgroup\$ – musicman523 May 14 '17 at 16:04
  • \$\begingroup\$ Can you post the expanded version? \$\endgroup\$ – CalculatorFeline Jun 25 '17 at 20:58
  • \$\begingroup\$ @CalculatorFeline The equivalent C code is already here, if that's what you're asking for \$\endgroup\$ – musicman523 Jun 25 '17 at 21:50
1
\$\begingroup\$

Charcoal, 307 297 bytes

A”|‽2?{:×G↗”¦αA“6«eMηOU¶¿”¦ζA“9“e▷·gqε-g}”¦βA“9B{⦃⁺Bφ=;λO”¦ωAfizz¦φAbuzz¦γAbeer¦ηA”↶C▶▶d℅d¬r·US\λTθNevT◧→GM⁸ω┦τA“M↧k↓⁺*f÷,ψZ¢▶\¿|P“№κ×υpξXoW”¦σA.¶πF⮌…¹¦¹⁰⁰«A⎇⁻ι¹αζθ¿∧¬﹪鳬﹪ι⁵A⁺φγ﹪ι³Aφ﹪ι⁵AγεAηε⁺⁺⁺⁺⁺⁺⁺IιθεβIιθεπ¿⁻ι¹A⁻ι¹λA⁹⁹λA⎇⁻λ¹αζθ¿∧¬﹪볬﹪λ⁵A⁺φγ﹪λ³Aφ﹪λ⁵AγεAηε¿⁻ι¹AτδAσδ⁺⁺⁺⁺δλθεω

Try it online!

YES, WE CAN! Link to the verbose version, this can be golfed a lot, I'm sure.

\$\endgroup\$
  • \$\begingroup\$ Sadly you forgot to actually link to the verbose version, but that run of s looks suspicious... \$\endgroup\$ – Neil Dec 2 '17 at 13:19
1
\$\begingroup\$

tcl, 298

proc B i {set x " bottle[expr $i>1?"s":""] of [expr $i%3?$i%5?"beer":"":"fizz"][expr $i%5?"":"buzz"]"}
set i 99
time {puts "$i[B $i][set w " on the wall"], $i[B $i].
Take one down and pass it around, [incr i -1][B $i]$w."} 98
puts "1[B $i]$w, 1[B $i].
Go to the store and buy some more, 99[B 9]$w."

demo

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.