Class: TresRaya::Player

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

Direct Known Subclasses

DumbPlayer, HumanPlayer, 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/tres_raya/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/tres_raya/player.rb', line 7

def mark
  @mark
end

Instance Method Details

#finish(final_board) ⇒ Object



13
14
# File 'lib/tres_raya/player.rb', line 13

def finish( final_board )  
end

#move(board) ⇒ Object

Raises:

  • (NotImplementedError)


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

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