Created
November 14, 2017 16:44
-
-
Save btaitelb/b10a25344823f46583f803508eddd4d3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
module DiceGame | |
def roll | |
die1 = rand(1..6) | |
die2 = rand(1..6) | |
@rolls ||= [] | |
@rolls << die1+die2 | |
end | |
def last_roll | |
@rolls&.last | |
end | |
def winner? | |
puts "WARNING: override winner?" | |
false | |
end | |
def run | |
until winner? | |
puts roll | |
end | |
puts "Winner!" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment