Sha256: 692d1f7a26aa1b04983a642069187c1bd9c0a89505142b048c5a75ac05121cc0

Contents?: true

Size: 325 Bytes

Versions: 2

Compression:

Stored size: 325 Bytes

Contents

module Game
  class CodeMaker
    CODE_DIGITS_COUNT = 4
    CODE_VALUE_MIN = 1
    CODE_VALUE_MAX = 6

    attr_accessor :code

    def initialize
      @code = generate_code
    end

    private

    def generate_code
      Array.new(CODE_DIGITS_COUNT).map { (CODE_VALUE_MIN..CODE_VALUE_MAX).to_a.sample }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
codebreaker_kosinskiy-0.1.2 lib/codebreaker/game/code_maker.rb
codebreaker_kosinskiy-0.1.0 lib/codebreaker/game/code_maker.rb