Method: NewSuperCodebreaker2021::Game#take_hint

Defined in:
lib/game.rb

#take_hint(user, used_hints) ⇒ Object


47
48
49
50
51
52
53
54
55
56
# File 'lib/game.rb', line 47

def take_hint(user, used_hints)
  code_copy = @code.dup
  if user.hints_total > user.hints_used
    user.hints_used += 1
    used_hints.each { |hint| code_copy.delete(hint) }
    code_copy.sample
  else
    false
  end
end