Elaborate a strategy to determine which one of the 12 coins is fake, and if it is lighter or heavier.
Beware, as you can use this balance 3 times at most. If you try to use it more than 3 times, the game ends, and you burn in hell also.
- Cloning this repo
- Implementing the `perform` method in the file `my_strategy.rb`
Some more instructions are given in this file if you are lost.
When you think you got it solved, run ruby am_i__a_pepite.rb
in your terminal to see the result of your efforts.
Good luck, and remember:
- Do not ever use the balance more than 3 times, or chaos will ensue
- Take a pick at the 'secret' directory and you'll be burnt to ashes in a glimpse. I wouldn't do that if I were you.
Call Measure.new(left_side_coins, right_side_coins).measure
with your left_side_coins
and right_side_coins
(arrays of coins, sub-arrays of the coins input).
The result will be one of the following: :left
, :right
, or :middle
- `:left` if the left side is heavier than the right side
- `:right` if the right side is heavier than the left side
- `:middle` if the left side and the right side of the balance are
For additional points, document your code, and explain why your strategy is better than everybody else's.
Congrats! Open a pull request with your solution!