com.anji.ttt
Class TttCenterPlayer

java.lang.Object
  extended bycom.anji.ttt.TttCenterPlayer
All Implemented Interfaces:
BoardPlayer, Player

public class TttCenterPlayer
extends java.lang.Object
implements BoardPlayer

"Bad" tic-tac-toe subject with a preference for playing in the center. See move() for details.

Author:
Philip Tucker

Constructor Summary
TttCenterPlayer()
          singleton; public for creation via reflection
 
Method Summary
static TttCenterPlayer getInstance()
           
 java.lang.String getPlayerId()
           
 int move(int[] boardState)
          Plays in center if open, otherwise plays randomly.
 void reset()
          reset player state; after a call to reset, the player should be in the same state as it was when created; i.e., it has no memory of previous games played
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TttCenterPlayer

public TttCenterPlayer()
singleton; public for creation via reflection

Method Detail

getInstance

public static TttCenterPlayer getInstance()
Returns:
singleton instance

getPlayerId

public java.lang.String getPlayerId()
Specified by:
getPlayerId in interface Player
Returns:
String unique ID
See Also:
Player.getPlayerId()

move

public int move(int[] boardState)
Plays in center if open, otherwise plays randomly.

Specified by:
move in interface BoardPlayer
Parameters:
boardState -
Returns:
next move
See Also:
BoardPlayer.move(int[])

reset

public void reset()
Description copied from interface: Player
reset player state; after a call to reset, the player should be in the same state as it was when created; i.e., it has no memory of previous games played

Specified by:
reset in interface Player
See Also:
Player.reset()

toString

public java.lang.String toString()
See Also:
Object.toString()