Package threeChess

Class Agent

  • All Implemented Interfaces:
    java.lang.Runnable
    Direct Known Subclasses:
    ManualAgent, RandomAgent

    public abstract class Agent
    extends java.lang.Object
    implements java.lang.Runnable
    An 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.
    • Constructor Detail

      • Agent

        public Agent()
        0 argument constructor. This is the constructor that will be used to create the agent in tournaments. It may be (and probably should be) overidden in the implementing class.
    • 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:
        toString in class java.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:
        run in interface java.lang.Runnable