org.generation5.ai
Class BoardGameAgent

java.lang.Object
  extended byorg.generation5.ai.BoardGameAgent

public abstract class BoardGameAgent
extends java.lang.Object

Abstract class designed to facilitate board game agent development.

See Also:
BoardGameAgent

Field Summary
protected  BoardGame boardGame
          The board game this agent is connected with.
protected  int playerID
          The player ID.
 
Constructor Summary
BoardGameAgent()
          Create a new instance of BoardGameAgent.
BoardGameAgent(int pid)
          Create a new instance of BoardGameAgent.
 
Method Summary
 BoardGame getBoardGame()
          Return the board game associated with this agent.
 int getPlayerID()
          Get the player ID.
abstract  void init()
          Initialize the agent.
 void setBoardGame(BoardGame game)
          Set the board game associated with this agent.
 void setPlayerID(int pid)
          Set the player ID.
abstract  int[] think()
          This abstract method should implement the agent's AI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

playerID

protected int playerID
The player ID.


boardGame

protected BoardGame boardGame
The board game this agent is connected with.

Constructor Detail

BoardGameAgent

public BoardGameAgent()
Create a new instance of BoardGameAgent.


BoardGameAgent

public BoardGameAgent(int pid)
Create a new instance of BoardGameAgent.

Parameters:
pid - the player ID.
Method Detail

think

public abstract int[] think()
This abstract method should implement the agent's AI. The move returned should be valid according to the board game's validMove method.

Returns:
the move to make.
See Also:
BoardGame.validMove(int, int[])

init

public abstract void init()
Initialize the agent.


setPlayerID

public void setPlayerID(int pid)
Set the player ID.

Parameters:
pid - the new player ID.

getPlayerID

public int getPlayerID()
Get the player ID.

Returns:
the current player ID.

setBoardGame

public void setBoardGame(BoardGame game)
Set the board game associated with this agent.

Parameters:
game - the new board game.

getBoardGame

public BoardGame getBoardGame()
Return the board game associated with this agent.

Returns:
the currently associated board game.

This documentation is part of the Generation5 JDK.