Skip to content

Instantly share code, notes, and snippets.

@btaitelb
Created November 14, 2017 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btaitelb/b10a25344823f46583f803508eddd4d3 to your computer and use it in GitHub Desktop.
Save btaitelb/b10a25344823f46583f803508eddd4d3 to your computer and use it in GitHub Desktop.
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