Package threeChess
Class Agent
- java.lang.Object
-
- threeChess.Agent
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
ManualAgent,RandomAgent
public abstract class Agent extends java.lang.Object implements java.lang.RunnableAn interface for AI bots to implement. They are simply given a Board object indicating the positions of all pieces, the history of the game and whose turn it is, and they respond with a move, expressed as a pair of positions. For Agents submitted to the CITS3001 tournament, in addition to implementing this interface, agents must use the naming convention: Agent########.java, where the hashes correspond to the authors student number; and each Agent must have a zero parameter constructor (but overloaded constructors are allowed).
-
-
Constructor Summary
Constructors Constructor Description Agent()0 argument constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidfinalBoard(Board finalBoard)Displays the final board position to the agent, if required for learning purposes.Position[]getMove()abstract Position[]playMove(Board board)Play a move in the game.voidrun()voidsetBoard(Board board)For running threaded games.abstract java.lang.StringtoString()
-
-
-
Method Detail
-
playMove
public abstract Position[] playMove(Board board)
Play a move in the game. The agent is given a Board Object representing the position of all pieces, the history of the game and whose turn it is. They respond with a move represented by a pair (two element array) of positions: the start and the end position of the move.- Parameters:
board- The representation of the game state.- Returns:
- a two element array of Position objects, where the first element is the current position of the piece to be moved, and the second element is the position to move that piece to.
-
toString
public abstract java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- the Agent's name, for annotating game description.
-
finalBoard
public abstract void finalBoard(Board finalBoard)
Displays the final board position to the agent, if required for learning purposes. Other a default implementation may be given.- Parameters:
finalBoard- the end position of the board
-
setBoard
public final void setBoard(Board board)
For running threaded games.
-
getMove
public final Position[] getMove()
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
-