Created
December 3, 2011 01:05
-
-
Save jdjkelly/1425591 to your computer and use it in GitHub Desktop.
Solution for about_dice_project
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
class DiceSet | |
def initialize | |
dice = [] | |
end | |
def roll(n) | |
@values = [] | |
for i in (1..n) | |
@values << rand(6) + 1 | |
end | |
end | |
def values | |
return @values | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This doesn't incorporate the tests, but collision is unlikely anyways. I think it's a fairly reasonable solution to the Koan.