Sha256: 1eb24b6a80def8151fb1ac22f8955088ca5f715e0b4ccc9eeec02f33ba2ec9d0
Contents?: true
Size: 538 Bytes
Versions: 1
Compression:
Stored size: 538 Bytes
Contents
# frozen_string_literal: true require_relative "guess_handler" require_relative "user" class Game include GuessHandler attr_reader :secret_code def initialize(user, difficulty) @secret_code = (1..4).to_a.map { |_num| rand(1..6) } @hint_array = @secret_code.map(&:clone) @num_of_hints = 2 @user = user @difficulty = difficulty end def give_a_hint if @num_of_hints.zero? puts "No more hints!" return end print @hint_array[0] @hint_array.shift @num_of_hints -= 1 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
codebreaker_kirill-0.2.1 | lib/codebreaker_kirill/game.rb |