Sha256: a2ec0d35525c400a15f8c7f6829b03581210dcca01e4345dbac5cc698ac2d653

Contents?: true

Size: 364 Bytes

Versions: 2

Compression:

Stored size: 364 Bytes

Contents

# frozen_string_literal: true

module BeforeGame
  class Hint
    attr_accessor :hints_count, :hints_items

    def initialize(hints_count:)
      @hints_count = hints_count
    end

    def generate_hints(code)
      @hints_items = code.sample(@hints_count)
    end

    def hint
      return false if @hints_count.zero?

      @hints_items.pop
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
codebreaker_kosinskiy-0.1.2 lib/codebreaker/before_game/hint.rb
codebreaker_kosinskiy-0.1.0 lib/codebreaker/before_game/hint.rb