26
4
It's friday! Which means it's time for beer!
Sadly though, today we will be golfing beer instead of drinking it. :(
Challenge
Output a beer and drink it. The amount of sips you take changes your output.
Sips
Your program should take one input string. This string can solely consist out of concatenated sip
s.
If the input is an empty string, you should output a full beer glass, including foam.
The more sips you take, the emptier your beer glass will be.
If you take 0 sips, your beer still has foam. The output of this foam is always the same (see examples).
If you take 1 sip, you should output the beer glass, followed by a new line and the string Yuck, foam.
.
If you take 1 or more sips, your beerglass should not contain anymore foam, but should show the top of your glass. Drinking the foam counts as one sip.
If you take 6 or more sips, you should output an empty beer glass, followed by a new line and the string Burp
.
For each sip you take, your beer glass should become emptier. How full your beerglass is depends on the amount of bubbles °
(°
) in your beer. For each sip you take after the foam, a line of bubbles should be removed. Each line of beer can contain a minimum of 1
and a maximum of 5
bubbles. The position of these bubbles should be 100% random.
Examples
input
empty input string, or no input at all
output
oo o oo
oooooooooooo
o| ° ° |\
| ° | \
| °° ° |} |
| ° ° | /
| ° °|/
\__________/
input
sip sip sip
output
____________
| |\
| | \
| ° |} |
|° ° ° | /
| ° ° |/
\__________/
input
sip sip sip sip sip sip sip sip sip sip
output
____________
| |\
| | \
| |} |
| | /
| |/
\__________/
Burp
This pastebin contains a list of inputs and outputs. Remember that the bubbles in the beerglass should be random!
Scoring
This is code-golf, shortest code in bytes wins!
Happy drinking golfing!
You might want to note that
°
is the character with code point 176. – Martin Ender – 2015-11-27T16:30:44.0272176 in Latin-1 and Unicode, to be more specific. – Mego – 2015-11-27T16:32:24.603
Is a trailing newline on inputs except 1 and 6+ acceptable? – ETHproductions – 2015-11-27T17:25:25.393
@ETHproductions yes. Will edit in when on laptop – Bassdrop Cumberwubwubwub – 2015-11-27T17:58:33.633
By 100% random does that mean that running the same input over and over should produce different acceptable mugs, and that the distribution of bubbles should be even for each bubble spot? – corsiKa – 2015-11-27T19:56:49.393
1The mug outputs should remain the same. The amount of bubbles on each line should differ every run. There can be only one bubble on each line, or up to 5. That's the random part of the challenge – Bassdrop Cumberwubwubwub – 2015-11-30T07:52:52.593
Is the foam fixed or also random? – Titus – 2016-10-20T09:55:33.387