Class: Tictactoe::Player

Inherits:
Object
  • Object
show all
Defined in:
lib/tictactoe/player.rb

Direct Known Subclasses

DumbPlayer, HumanPlayer, MinimaxPlayer, SmartPlayer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mark) ⇒ Player

Returns a new instance of Player.



5
6
7
# File 'lib/tictactoe/player.rb', line 5

def initialize( mark )
  @mark = mark # "X" or "O" or " "
end

Instance Attribute Details

#markObject (readonly)

Returns the value of attribute mark.



9
10
11
# File 'lib/tictactoe/player.rb', line 9

def mark
  @mark
end

Instance Method Details

#finish(final_board) ⇒ Object



15
16
# File 'lib/tictactoe/player.rb', line 15

def finish( final_board )  
end

#move(board) ⇒ Object

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/tictactoe/player.rb', line 11

def move( board )
  raise NotImplementedError, "Player subclasses must define move()."
end