Background
It's late Friday afternoon and you and your friends decide to hit the pub later that evening, but before going to the pub you figure you should have a few beverages. However, things escalate quickly; your friend Shaddock Pamplemousse won the lottery earlier this week and decided to bring crates upon crates with different beverages. The security at the pub is very strict, and if you overconsume before trying to enter the premises you are not allowed inside. You are all programmers though - so you figure things will turn out great anyway.
Challenge
You need to program an alcohol meter which outputs truthy/falsy if you're above/below the reasonable pub limit.
Before you go down to the pub you enter the amount and beverage type you've consumed during the evening to stdin
which your measurement program reads.
If it outputs truthy, you are above the pub limit and stay at home. If it outputs falsy, you're good to go.
Input
One integer greater than 0
which represents your body weight in kilograms followed by a newline.
This input is followed by a series of one digit amounts and beverages on the following form:
<amount><amount type>o<beverage type>
For one bottle of beer this will look like:
1Bob
Each input is separated by a space.
Input specification
Each beverage has a unit which correspond to the impact caused by it. If you consume more units than your weight divided by two the pub is not an option anymore.
(This may or may not reflect reality)
The following are valid beverages and the corresponding alcoholic units of the beverage:
Beer:
b
,1
unitEnergy drink:
e
,0
unitsHot sauce:
h
,2
units (strong stuff)Juice (made of organic fruits etc):
j
,0
unitsRum:
r
,6
unitsTequila:
t
,7
unitsVodka:
v
,6
unitsWine:
w
,3
units
There are different amount types:
Bottle:
B
Crate:
C
Glass:
G
Keg:
K
Sip:
S
Each amount type has a multiplier which multiplies the alcoholic units of the beverage contained in it:
Bottle:
3
Crate:
25
Glass:
2
Keg:
50
Sip:
0.2
Output
Your program shall output truthy/falsy to stdout
if the amount consumed is above/below your body weight divided by 2. If the amount consumed is equal to your weight divided by 2, you should output falsy.
Samples of possible input and output
Input
70
1Bob 3Soj
Output
False
Input
2
1Cov
Output
1
Input
50
1Cob
Output
0
Input
100
4Gow 1Koe 1Bov 1Gow 2Sot
Output
True
The shortest program in bytes wins!
o
is a format character, though you've not said so specifically. You should clarify this (aso
also refers to olive oil.) 2. What do we output if we are exactly on the limit? or doesn't it matter? \$\endgroup\$43Gow
? \$\endgroup\$