这是代码
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
现在这段代码不完整,我需要 @determinant 变量实际上是 param1 和 param2 的总和才能继续。
这是命令行活动的简短摘要
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