lib/codebreaker/game.rb in codebreaker-Bulatkin-0.1.2 vs lib/codebreaker/game.rb in codebreaker-Bulatkin-0.2.0

- old
+ new

@@ -38,20 +38,24 @@ def lost? attempts.zero? end def to_yaml(name) + data_to_save(name).to_yaml + end + + def data_to_save(name) { name: name, difficulty: difficulty[:mode], attempts_total: difficulty[:attempts], attempts_used: difficulty[:attempts] - attempts, hints_total: difficulty[:hint], hints_used: difficulty[:hint] - hint_keeper.size - }.to_yaml + } end - def attempt_used + def use_attempt! @attempts -= 1 end def guess(guess) '+' * exact_match_count(guess) + '-' * number_match_count(guess)