Sha256: 4f82fa2279d9f6c49c5f0dc206bcd881bb07ae06b41798ff9f15b3abf4d4a711
Contents?: true
Size: 555 Bytes
Versions: 1
Compression:
Stored size: 555 Bytes
Contents
require File.join('games', 'mastermind', 'pegs') require File.join('games', 'mastermind', 'peg') module MM module PegsFactory def self.build_empty_pegs(rows = 12, cols = 4, pegs_class = Pegs) pegs = Array.new(rows) do Array.new(cols) end pegs.each_with_index do |element, row| element.each_index do |col| pegs[row][col] = create_empty_peg end end pegs_class.new(collection_of_pegs: pegs) end def self.create_empty_peg( peg_class = Peg) peg_class.new end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
games_bfox-0.6.0 | lib/games/mastermind/pegs_factory.rb |