Here in California, we're in a drought so we need to know how much water we have left so we can conserve as much water as possible.
Because water is limited supply, your code will need to be as short as possible.
Examples
| |
| |
|~~~|
|___|
Output: 0.5
|~~~~~|
| |
| |
|_____|
Output: 1
| |
|__|
Output: 0 (or bonus)
Specification
The input will consist solely of all of: |_ ~
and newlines. All above the ~
's are considered air; _
, spaces below ~
, and ~
itself are considered water. The percent of water left is computer by water / (air + water)
. Your output needs to be accurate to 4 decimal places (unless you go for the percent bonus). The input will always be rectangular. The ~
will only be on one line, if on any. The input may optionally also have a trailing line feed if you'd like.
Bonus
If you go for both bonuses the -15% bonus is applied before the -35 bonus
-35 byte Bonus: If your code prints "This drought goat out of hand", instead of 0 when the Output is 0
-15% Bonus: If you output a percent.
To do this, you would shift the decimal place two places to the left, trim leading zeros, and add a %
to the end. Trailing zeros (max 2) are allows as long as they don't affect the value. 0.5
-> any of: 50.00% 50% 50.0%
|~~~|
(no underscore) valid input? \$\endgroup\$