"99 bottles of fizz"

55

1

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.

musicman523

Posted 2017-05-12T19:03:33.920

Reputation: 4 472

31I have 95 bottles of fizz. I take one away. Now I have 94 bottles of beer. Logic. – Okx – 2017-05-12T19:10:39.253

2Can I have a bottle of fizzbeer? – Stephen – 2017-05-12T19:15:50.657

1Is there supposed to be a newline after the 3rd bottle? – user41805 – 2017-05-12T19:29:45.753

Nope, my bad. Fixing now. – musicman523 – 2017-05-12T19:32:17.630

2Is a newline required between the two lines? Before Kritixi Lithos's edit there were none and now there are. – dzaima – 2017-05-12T19:36:34.297

11@Okx Well, beer is fizzy and gives you a buzz... – Draco18s no longer trusts SE – 2017-05-12T22:09:48.377

@dzaima There should be newlines between each verse, but not within the verses. Trailing newline is OK but not required. – musicman523 – 2017-05-13T01:01:58.377

Should it be infinite? – MD XF – 2017-05-13T21:37:53.900

@MDXF The last line posted should be where it stops – musicman523 – 2017-05-14T00:26:45.373

What is a "fizz"? ;) – None – 2017-05-15T09:21:40.357

I like the "just output "beer" as usual." :). – 6infinity8 – 2017-06-08T22:20:40.727

Related: 1, 2, Fizz, 4, Buzz

– sergiol – 2017-06-25T11:41:12.713

Related: “99 Bottles of Beer”

– sergiol – 2017-06-25T11:43:16.327

@sergiol of course they're related, they inspired the challenge! – caird coinheringaahing – 2017-06-26T14:06:44.140

Answers

12

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!

Rod

Posted 2017-05-12T19:03:33.920

Reputation: 17 588

This is awesome! Can you explain why interpolating the strings is the shortest option? – musicman523 – 2017-05-13T02:23:06.137

2For example ['ab','cd'][x] can be rewritten as 'acbd'[x::2], just to save some bytes – Rod – 2017-05-13T04:01:04.643

7

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, ");}

Quentin

Posted 2017-05-12T19:03:33.920

Reputation: 1 187

This is super cool! I'm always shocked at how good C answers can be with string manipulation. – musicman523 – 2017-05-13T02:24:52.827

Save a few bytes by changing #define w" on the wall" to *w=" on the wall". – MD XF – 2017-05-14T00:38:41.050

@MDXF mmh, I get the exact same byte count. Am I missing something? – Quentin – 2017-05-14T11:48:52.570

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*. – musicman523 – 2017-05-14T15:59:10.267

4@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. – Quentin – 2017-05-14T16:07:42.260

@Quentin Ah, true. I didn't quite gather that from your submission, my bad. – MD XF – 2017-05-14T19:27:31.093

Does "s"+!~-i help? – Neil – 2017-05-15T20:40:05.540

@Neil OMG that's awful, I love it! Thanks, I muddled around with offsetting "s", but didn't come around to a short enough syntax :) – Quentin – 2017-05-15T20:52:54.933

6

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.

user41805

Posted 2017-05-12T19:03:33.920

Reputation: 16 320

6

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.

";

Jörg Hülsermann

Posted 2017-05-12T19:03:33.920

Reputation: 13 026

1If 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.↵↵";}. :) – insertusernamehere – 2017-05-13T14:13:03.120

1@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 – Jörg Hülsermann – 2017-05-13T14:57:19.997

5

05AB1E, 151 146 143 bytes

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

Try it online!

Emigna

Posted 2017-05-12T19:03:33.920

Reputation: 50 798

4

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))

dzaima

Posted 2017-05-12T19:03:33.920

Reputation: 19 048

4

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.)!

Arjun

Posted 2017-05-12T19:03:33.920

Reputation: 4 544

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". – Neil – 2017-05-15T20:52:53.137

4

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");
 }
}

h.j.k.

Posted 2017-05-12T19:03:33.920

Reputation: 589

3

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.

Neil

Posted 2017-05-12T19:03:33.920

Reputation: 95 035

2

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.

eush77

Posted 2017-05-12T19:03:33.920

Reputation: 1 280

2

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'
    )
}

nderscore

Posted 2017-05-12T19:03:33.920

Reputation: 4 912

2

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!

MD XF

Posted 2017-05-12T19:03:33.920

Reputation: 11 605

1

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.

MD XF

Posted 2017-05-12T19:03:33.920

Reputation: 11 605

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

– musicman523 – 2017-05-14T16:04:28.510

Can you post the expanded version? – CalculatorFeline – 2017-06-25T20:58:53.167

@CalculatorFeline The equivalent C code is already here, if that's what you're asking for

– musicman523 – 2017-06-25T21:50:53.590

1

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!

Alex

Posted 2017-05-12T19:03:33.920

Reputation: 371

1

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

sergiol

Posted 2017-05-12T19:03:33.920

Reputation: 3 055

1

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.

Charlie

Posted 2017-05-12T19:03:33.920

Reputation: 11 448

Sadly you forgot to actually link to the verbose version, but that run of s looks suspicious... – Neil – 2017-12-02T13:19:52.830