lib/app/entities/game.rb in codebreaker_ruban-0.3.6 vs lib/app/entities/game.rb in codebreaker_ruban-0.3.7
- old
+ new
@@ -1,11 +1,11 @@
# frozen_string_literal: true
module CodebreakerRuban
class Game
include Validation
- attr_reader :difficulty, :attempts_total, :hints_total, :user, :secret_code, :datetime
+ attr_reader :difficulty, :attempts_total, :hints_total, :user, :hints_showeded, :secret_code, :datetime
attr_accessor :attempts_used, :hints_used, :errors, :guess_code
LENGTH_GUESS = 4
RANGE_SECRET_CODE = (1..6).freeze
DIFFICULTY = {
@@ -14,18 +14,18 @@
hell: { hints_total: 1, attempts_total: 5, difficulty: 'hell' }
}
def initialize(difficulty, user)
@user = user
- binding.pry
@difficulty = difficulty[:difficulty]
@secret_code = generator_secret_code
@attempts_total = difficulty[:attempts_total]
@hints_total = difficulty[:hints_total]
@hint = secret_code.clone.shuffle
@hints_used = 0
@attempts_used = 0
+ @hints_showed = []
@datetime = Time.now
@guess_code = nil
@errors = []
end
@@ -51,10 +51,10 @@
end
def hint_use
if @hints_used < @hints_total
@hints_used += 1
- @hint.pop
+ @hints_showed << @hint.pop
else
clear_errors
errors << Message.error_guess_code
end
end