Here’s the code
class RockPaperScissors
attr_reader :rock, :paper, :scissors, :determinant
def initialize
@rock=1
@paper=2
@scissors=4
@determinant=0
end
def play(param1, param2)
@determinant = param1 + param2
puts @determinant
end
end
Now this code is not complete, I need for the @determinant variable to actually be the sum of param1 and param2 to continue.
Here is an abbreviated summary of the command line activity
irb
source "rps2.rb"
rps = RockPaperScissors.new
rps.play(:scissors, :rock)
NoMethodError: undefined method '+' for :scissors:Symbol
from rps2.rb.rb:14:in 'play'
from (irb):23
If you have “attr_reader” you need to play this way:
Another possible way to use symbols: