net.bluebones.boggle
Class AIPlayer

java.lang.Object
  extended by net.bluebones.boggle.Player
      extended by net.bluebones.boggle.AIPlayer

public class AIPlayer
extends Player

Computer opponent.

Version:
0.3 $Revision: 1.6 $
Author:
Thomas David Baker

Constructor Summary
AIPlayer(Player parentPlayer)
          Initializes an AIPlayer that can find words of any length.
AIPlayer(Player parentPlayer, int rating)
          Initializes an AIPlayer with the specified rating.
 
Method Summary
 void addWord(String word)
          Adds word to the list of words this AI has found.
static AIPlayer[] getAIPlayers(Player parentPlayer)
          Creates a group of AI players to use as standard.
 IServer getLocalServer()
          Returns null as AI does not use a local server.
 String[] getWords()
          Gets the words this AI has found.
 void hostGame()
          Does nothing (interface requirement).
 void info(String msg)
          Relays the specified message to the owner of this AIPlayer.
 void init(char[][] letters, int timeInSecs)
          Does nothing (interface requirement).
 void problem(String msg)
          Notifies the owner of this AIPlayer of the specified problem.
 void results(Round round)
          Does nothing (interface requirement).
 void setBoard(char[][] letters)
          Does nothing (interface requirement).
 void setConnection(ConnectionType type, String addr, int clients)
          Does nothing (interface requirement).
 void setConnection(ConnectionType type, String addr, int clients, int dots)
          Does nothing (interface requirement).
 void setLocalServer(Server server)
          Does nothing (interface requirement).
 void setRubber(Rubber r)
          Does nothing (interface requirement).
 void setTimer(int amount)
          Does nothing (interface requirement).
 void startLocalGame(char[][] letters, int time)
          Starts a local game.
 void startNetworkGame()
          Does nothing (interface requirement).
 void stopGame()
          Stops this AI finding words.
 String toString()
          Gets a String representation of this AI.
 
Methods inherited from class net.bluebones.boggle.Player
connecting, connectingTo, createRegistry, endGame, getClient, getClients, getGame, getHostInfo, getPort, getRegistry, getRemoteServer, hostConnectionLost, joinGame, setClient, setConnecting, setGame, setHostInfo, setNotConnecting, setRegistry, setRemoteServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AIPlayer

public AIPlayer(Player parentPlayer)
Initializes an AIPlayer that can find words of any length.

Parameters:
parentPlayer - The "owner" of this AIPlayer.

AIPlayer

public AIPlayer(Player parentPlayer,
                int rating)
Initializes an AIPlayer with the specified rating.

Parameters:
parentPlayer - The "owner" of this AIPlayer.
rating - The relative strenght of this AIPlayer.
Method Detail

info

public void info(String msg)
Relays the specified message to the owner of this AIPlayer.

Specified by:
info in class Player
Parameters:
msg - Message to relay.

problem

public void problem(String msg)
Notifies the owner of this AIPlayer of the specified problem.

Specified by:
problem in class Player
Parameters:
msg - Message to relay.

startNetworkGame

public void startNetworkGame()
Does nothing (interface requirement).


startLocalGame

public void startLocalGame(char[][] letters,
                           int time)
Starts a local game.

Overrides:
startLocalGame in class Player
Parameters:
letters - Letters to initialize the board with.
time - Duration of game in seconds.

addWord

public void addWord(String word)
Adds word to the list of words this AI has found.

Parameters:
word - String word to add.

getWords

public String[] getWords()
Gets the words this AI has found.

Specified by:
getWords in class Player
Returns:
String[] of all words the AI has found this turn.

stopGame

public void stopGame()
Stops this AI finding words.

Specified by:
stopGame in class Player

hostGame

public void hostGame()
Does nothing (interface requirement).


setBoard

public void setBoard(char[][] letters)
Does nothing (interface requirement).


setTimer

public void setTimer(int amount)
Does nothing (interface requirement).

Specified by:
setTimer in class Player
Parameters:
amount - Amount to set the display to in tenths of a second.

init

public void init(char[][] letters,
                 int timeInSecs)
Does nothing (interface requirement).

Specified by:
init in class Player
Parameters:
letters - char[][] of letters on the board.
timeInSecs - int time of the round in seconds.

setRubber

public void setRubber(Rubber r)
Does nothing (interface requirement).

Specified by:
setRubber in class Player
Parameters:
r - Rubber details to deal with.

setConnection

public void setConnection(ConnectionType type,
                          String addr,
                          int clients)
Does nothing (interface requirement).

Specified by:
setConnection in class Player
Parameters:
type - ConnectionType type of connection.
addr - String address connected to.
clients - int number of clients attached to this Player.

setConnection

public void setConnection(ConnectionType type,
                          String addr,
                          int clients,
                          int dots)
Does nothing (interface requirement).

Specified by:
setConnection in class Player
Parameters:
type - ConnectionType type of connection.
addr - String address connected to.
clients - int number of clients attached to this Player.
dots - int number of dots to be displayed by the client at this time. Maximum of three.

setLocalServer

public void setLocalServer(Server server)
Does nothing (interface requirement).

Specified by:
setLocalServer in class Player
Parameters:
server - Server to set as local server or null to unset.
Throws:
IllegalArgumentException - If called with non-null server.

getLocalServer

public IServer getLocalServer()
Returns null as AI does not use a local server.

Specified by:
getLocalServer in class Player
Returns:
Local server or null.

results

public void results(Round round)
Does nothing (interface requirement).

Specified by:
results in class Player
Parameters:
round - Round result details.

getAIPlayers

public static AIPlayer[] getAIPlayers(Player parentPlayer)
Creates a group of AI players to use as standard.

Parameters:
parentPlayer - The "owner" of these AIs.
Returns:
AIPlayer[] of AIs.

toString

public String toString()
Gets a String representation of this AI.

Overrides:
toString in class Object
Returns:
String representation.