Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: 99 bottles, 2 lines

by lanval (Novice)
on Apr 27, 2004 at 01:57 UTC ( #348388=note: print w/replies, xml ) Need Help??

in reply to 99 bottles, 2 lines

The problem occurs when you must decide whether to write "bottle" or "bottles". Some replies above do not take this into account despite the original poster doing so. Just for fun, here is my solution (longer than the original though). It is 178 characters long:
($a,$b,$c,$n)=(" bottle"," of beer"," on the wall",99);sub u{$s=$n-1?" +s":();$e="$n$a$s$b"}while($n){u;print"$e$c, $e!\nTake one down, pass +it around,\n";$n--;u;print"$e$c!\n\n"}

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://348388]
[Discipulus]: karl you says the same of my mom: in your place I'd been
[Discipulus]: preoccupied.. ;=)
Discipulus stopped with turkisk spices anyway.. but better hashes than arrays!
[oiskuu]: Discipulus, from the edge or from the top?
[Discipulus]: oiskuu from the top aka 0-0 coords
[LanX]: edge or node?
[oiskuu]: from each height difference, there's a fixed number of "moves right" - "moves left". So it's a number of combinations.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2018-03-19 11:01 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (239 votes). Check out past polls.