Sha256: 889ea3ff7aab444ef7047537bdc3d1beb06f95a19716685bbbe79653105d02cd

Contents?: true

Size: 441 Bytes

Versions: 2

Compression:

Stored size: 441 Bytes

Contents

require_relative '../shared/player'

module MM
  class PlayersFactory
    #returns an array in case we would like to extend the game to allow for multiple players
    def generate_players(config)
      if config.code_setter == :computer
        player_1 = Shared::Player.new(name: config.player_1_name)
      else
        player_1 = Shared::Player.new(name: config.player_1_name, type: :computer)
      end
      [player_1]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
games_bfox-0.3.0 lib/games/mastermind/players_factory.rb
games_bfox-0.2.0 lib/games/mastermind/players_factory.rb