Not sure where I'm going wrong here. I've tried researching my problem but have run out of search string ideas for google.(so much so they thought I was a bot) My RNG guessing game seems to generate a new number constantly and not save the number for the current session of the game for the player to guess. I don't know if I'm just trying to make this more difficult that it needs to be.
def initialize
@@answer = rand(1..100).to_s
end
def answer
@@answer
end
def guessing
puts "What's your guess?"
@@guess = gets.chomp.downcase
while @@guess != answer
wrong_answer
end
right_answer
end
Aucun commentaire:
Enregistrer un commentaire