Sha256: 0be9165fbd85e99d4233017832633b884e5ae88770f7240147e9afaee6ccffa6

Contents?: true

Size: 523 Bytes

Versions: 1

Compression:

Stored size: 523 Bytes

Contents

module NumberGuessGame
  class Runner
    def self.start
      max_guesses = 5
      number_to_guess = (1..1000).to_a.sample
      guesser = GuessNumber.new(number_to_guess, max_guesses)

      puts 'Guess the number. You have three changes:'

      max_guesses.times do |number|
        puts "#{number + 1}/#{max_guesses} guess: ---> "
        guess = gets.chomp
        guess_response = guesser.number_guessed?(guess)
        puts guess_response.message
        break if guess_response.result
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
number_guess_game-0.1.1 lib/number_guess_game/runner.rb