Sha256: 8cb0867c1d99c3f2a2e662611a7b85b071d6476716e2b7c880b0826db3b72c75

Contents?: true

Size: 267 Bytes

Versions: 4

Compression:

Stored size: 267 Bytes

Contents

module Codebreaker
  class Hint
    def initialize(difficulty, secret_code)
      @difficulty = difficulty
      @hints = secret_code.sample(difficulty.hints)
    end

    def call
      raise Errors::NoHintsError if @hints.empty?

      @hints.pop
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cb-core-0.1.3 lib/codebreaker/hint.rb
cb-core-0.1.2 lib/codebreaker/hint.rb
cb-core-0.1.1 lib/codebreaker/hint.rb
cb-core-0.1.0 lib/codebreaker/hint.rb