class AiClassGame
def calculate_cpuNum(sum)
if sum <= 79
cpuNum = 80 - sum
elsif sum <= 88
cpuNum = 89 - sum
else
cpuNum = 100 - sum
end
#puts 'calculate method'
end
calculate_cpuNum 是我得到调用错误的方法
if sum >= 71
calculate_cpuNum(sum)
else
sum += cpuNum
checkPlayer = false
puts 'sum = ' + sum.to_s
break if sum >= 100
end
puts 'Computer has choosen : ' + cpuNum.to_s, 'sum = ' + sum.to_s
end
我得到错误
ai_class_game.rb:39 in <class:AiClassGame>: undefined methodcalculate_cpuNum` for AiClassGame:Class (NoMethodError)from ai_class_game.rb:7:in `<main>`