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.



3
4
5
# File 'lib/tictactoe/player.rb', line 3

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

Instance Attribute Details

#markObject (readonly)

Returns the value of attribute mark.



7
8
9
# File 'lib/tictactoe/player.rb', line 7

def mark
  @mark
end

Instance Method Details

#move(board) ⇒ Object

Raises:

  • (NotImplementedError)


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

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