Commit f9eafab
Changed files (3)
lib
mathy
operations
lib/mathy/operations/addition.rb
@@ -8,8 +8,8 @@ module Mathy
@key = "+"
end
- def play_turn(x: rand(10), y: rand(20), correct_answer: x + y)
- @verifier.check_answer("#{x} + #{y} = ", correct_answer)
+ def play_turn(x: rand(10), y: rand(20))
+ @verifier.check_answer("#{x} + #{y} = ", x + y)
end
def matches?(other_key)
lib/mathy/operations/subtraction.rb
@@ -8,8 +8,8 @@ module Mathy
@key = "-"
end
- def play_turn(x: rand(10), y: rand(20), correct_answer: x - y)
- @verifier.check_answer("#{x} - #{y} = ", correct_answer)
+ def play_turn(x: rand(10), y: rand(20))
+ @verifier.check_answer("#{x} - #{y} = ", x - y)
end
def matches?(other_key)
lib/mathy/game.rb
@@ -7,7 +7,7 @@ module Mathy
def play(games_to_play = 2, operation)
games_to_play.times do
- @score += 1 if operation.play_turn(x: rand(10), y: rand(20))
+ @score += 1 if operation.play_turn
end
display_results(@name, @score, games_to_play)