Class: TicTacToe::PlayerFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/ttt/player_factory.rb

Class Method Summary collapse

Class Method Details

.create(input) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/ttt/player_factory.rb', line 3

def self.create(input)
  case input[:type]
  when :ai
    AI.new(input[:mark])
  when :human
    Human.new(input[:mark])
  else
    raise "Invalid Player Type"
  end
end