Sha256: f9d230d037216a610f0720c55738f3fa01c761bfc92dbf3b8440ef74ba944a56
Contents?: true
Size: 624 Bytes
Versions: 1
Compression:
Stored size: 624 Bytes
Contents
module Codebreaker class GameStage < BaseClass attr_reader :step_number, :endgame, :attempts, :compare_result, :win attr_accessor :hint_used def initialize(attempts:) @step_number = 1 @endgame = false @attempts = attempts @compare_result = [] @hint_used = 0 end def step(compare_result) @compare_result = compare_result @step_number += 1 @win = @compare_result.length == Game::CODE_LENGTH && @compare_result.all? @endgame = true if !valide_allow_step? || @win end def valide_allow_step? @attempts >= @step_number end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
codebreaker-ga-0.2.12 | lib/codebreaker/game_stage.rb |