Last active
December 17, 2015 16:39
-
-
Save pathouse/5640776 to your computer and use it in GitHub Desktop.
Working through the Greed scoring problem in Ruby Koans, the first two lines of my solution made me smile. Thanks Ruby. For context, 'dice' is an array of 5 numbers representing 5 die rolls.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def score(dice) | |
dice_hash = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0} | |
count = dice.each {|x| dice_hash[x.to_s] += 1} | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment