jaige
Class AI

java.lang.Object
  extended by jaige.Player
      extended by jaige.AI
All Implemented Interfaces:
GameListener, TurnListener
Direct Known Subclasses:
AtaxxAI, HexAI

public abstract class AI
extends Player
implements TurnListener

This is the base class of all AIs. Extend this class to implement an AI, create a jar, and place it in the plugins directory. Please perform all initialization in the initialize method, and only call super() in your constructor. Imagine a list of 100 AI's and the user wants to pick 2 of them. Each one needs to have unique information, but instead of initializing all 100 of them, we just initialize the 2 we need. This is especially useful for an AI that loads a database of moves, there is no point in loading the database if it isn't the AI playing.

Copyright (c) Jaige 2007

Version:
1.1
Author:
Rob Taft

Constructor Summary
AI()
          This is the default constructor that, when called with super(), will set the name from getAIName() to getName() in the Player class.
 
Method Summary
abstract  java.lang.String getAIName()
          Returns the unique name of this AI.
abstract  java.lang.String getAuthor()
          Returns the name of the author that created this AI.
abstract  java.lang.String getInfo()
          Returns information about this AI that the user might want to see.
abstract  Version getVersion()
          This is used to determine the version of the AI playing.
abstract  void initialize()
          Initializes this AI, this should be used to initialize the AI instead of the constructor.
protected  void makeMove(int... i)
          Subclasses should call this method to perform their move.
abstract  void uninitialize()
          Preforms any cleanup needed on the AI.
 
Methods inherited from class jaige.Player
getColor, getName, getOrientation, setColor, setName, setOrientation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jaige.event.TurnListener
processTurnEvent
 

Constructor Detail

AI

public AI()
This is the default constructor that, when called with super(), will set the name from getAIName() to getName() in the Player class.

Method Detail

getVersion

public abstract Version getVersion()
This is used to determine the version of the AI playing. This is helpful in testing a newer version of the AI against an older one. It also helps identify newer AI's when they are uploaded to a competative server.

Returns:
Version of this AI.

getInfo

public abstract java.lang.String getInfo()
Returns information about this AI that the user might want to see. Typical things included in here are algorithms, background info, strategy, etc.

Returns:
Information about this AI that the user might want to see.

getAIName

public abstract java.lang.String getAIName()
Returns the unique name of this AI. It should be set to something that is unique enough that no other AI's could possibly use the same name.

Returns:
The unique name of this AI.

getAuthor

public abstract java.lang.String getAuthor()
Returns the name of the author that created this AI.

Returns:
Authors name.

initialize

public abstract void initialize()
Initializes this AI, this should be used to initialize the AI instead of the constructor. The AI constructor should be empty! Place initialization code in this method. Fields should be declared, but not initialized until this method.


uninitialize

public abstract void uninitialize()
Preforms any cleanup needed on the AI. This includes unloading any databases that may have been loaded. The idea is to make the memory footprint of this class as small as possible until it is needed again. The initialize() method will be called before this AI is called to action again.


makeMove

protected void makeMove(int... i)
Subclasses should call this method to perform their move. This method takes advantage of varargs that was added to Java 5. A player should call it with the number of variables that are required to make a move in a particular game. Games that require a single point, just require 2 variables (x and y). Games that move pieces from one point to another, require 4 variables (from x, from y, to X, to y)

Parameters:
i - The values of the move desired to be made.