Sha256: 3030d2a252e696a62eb9c3b92e6b852a8e37001eec3f495eb4fe9ef051cb8a7a

Contents?: true

Size: 728 Bytes

Versions: 1

Compression:

Stored size: 728 Bytes

Contents

# frozen_string_literal: true

module Codebreaker
  class DifficultyFactory
    DIFFICULTIES = {

      easy: {
        name: 'easy',
        attempts: 15,
        hints: 2
      },
      medium: {
        name: 'medium',
        attempts: 10,
        hints: 1
      },
      hell: {
        name: 'hell',
        attempts: 5,
        hints: 1
      }

    }.freeze
    def self.generate(difficulty_name)
      case difficulty_name
      when DIFFICULTIES[:easy] then Difficulty.new(DIFFICULTIES[:easy])
      when DIFFICULTIES[:medium] then Difficulty.new(DIFFICULTIES[:medium])
      when DIFFICULTIES[:hell] then Difficulty.new(DIFFICULTIES[:hell])
      else raise Errors::InvalidDifficultyError
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
codebreaker_manfly-0.1.2 lib/codebreaker/difficulty_factory.rb