I was browsing the 99 bottles of beer site and saw someone had submitted a minimal (but grammatically incorrect for "1 bottle") Perl version at 140bytes.

So, I had a play, and came up with these:

```# minimalist, grammatically incorrect (126 bytes)
\$c=' bottles of beer';\$d=' on the wall';\$i=99;warn"\$i\$c\$d,\n\$i\$c,\nTak
+e one down and pass it around,\n",--\$i,"\$c\$d\n\n"while\$i

# minimalist, grammatically correct (167 bytes)
\$_=' bottles of beer';\$d=' on the wall';\$i=99;sub f{\$i-1?s/e\b/es/:s/s
+//;\$_};warn\$i.f."\$d,\n\$i".f.",\nTake one down and pass it around,\n",
+--\$i||'No',f."\$d\n\n"while\$i

Anyone got any better ones?

.02

cLive ;-)

Replies are listed 'Best First'.
Re: Golf: Back to those damn beer bottles again...
by Anonymous Monk on Mar 16, 2003 at 05:49 UTC
Re: Golf: Back to those damn beer bottles again...
by benn (Vicar) on Mar 17, 2003 at 21:58 UTC
Oooh - that's a fun squeeze. I missed the last lot, so I thought I'd join in here. Even on the 99 bottles site, opinion seems to be divided as to whether it's "Take one down, pass it around" or "Take one down *and* pass it around" - 3 bytes is important in this game....:) Anyway, here's a gramamatically correct one weighing in at 156 bytes with the 'and'.
```\$n=99;warn \$b=&b,\$w=" on the wall",", \$b,\nTake one down and pass it a
+round,\n".&b(--\$n)."\$w.\n"while\$n;sub b{\$s=\$n-1?'s':'';(\$n||'No')." b
+ottle\$s of beer"}
Maybe there should be an ISO '99 bottles' standard to establish these important questions of 'and' or ',', 'No' or '0', plurals, CRs etc.. :)
You obviously didn't look too closely at my attempt! Shaved another 3 bytes of by predeclaring the sub before use, making the & optional: and shaved a space after the warn...

And if we cheat with the 'and' and the 'one' :), we get down to 149 ;-)

```sub b{\$s=\$n-1?'s':'';(\$n||'No')." bottle\$s of beer"}\$n=99;warn\$b=b,\$w=
+" on the wall",", \$b,\nTake 1 down & pass it around,\n".b(--\$n)."\$w.\
+n"while\$n;
cLive ;-)
lol - no - I got so wrapped up in everybody elses attempts in the previously-referenced nodes that I missed the fact I'd written a virtual dupe of yours (other than the plural handling) :) I reckon you should replace the '1' and '&' cheats and declare yourself a winner with 153...though there's still something smelly about the bottle(s) - I'm convinced there's shaving to be done there somewhere...
Re: Golf: Back to those damn beer bottles again...
by mojotoad (Monsignor) on Mar 17, 2003 at 19:27 UTC
Also of note:

Matt