Class: Factory
- Inherits:
-
Object
- Object
- Factory
- Defined in:
- lib/factory.rb
Instance Method Summary collapse
Instance Method Details
#get_board(board_type) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/factory.rb', line 8 def get_board board_type case board_type when :three_by_three then TwoDimensionalBoard.new 3 when :four_by_four then TwoDimensionalBoard.new 4 when :five_by_five then TwoDimensionalBoard.new 5 when :cube_three then ThreeDimensionalBoard.new 3 end end |
#get_player(player_type, symbol) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/factory.rb', line 17 def get_player player_type, symbol case player_type when :human then HumanPlayer.new(symbol) when :easy_ai then ComputerAI.new(symbol, 10) when :medium_ai then ComputerAI.new(symbol, 50) when :unbeatable_ai then ComputerAI.new(symbol, 100) end end |