Class: MM::PlayersFactory
- Inherits:
-
Object
- Object
- MM::PlayersFactory
- Defined in:
- lib/games/mastermind/players_factory.rb
Instance Method Summary collapse
-
#generate_players(config) ⇒ Object
returns an array in case we would like to extend the game to allow for multiple players.
Instance Method Details
#generate_players(config) ⇒ Object
returns an array in case we would like to extend the game to allow for multiple players
6 7 8 9 10 11 12 13 |
# File 'lib/games/mastermind/players_factory.rb', line 6 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 |