net.antichess.ai
Class AntichessAIPlayer

java.lang.Object
  |
  +--net.antichess.ai.AntichessAIPlayer

public abstract class AntichessAIPlayer
extends Object

Proposed base class for antichess AI player.

Author:
Michael Bolin

Field Summary
protected  boolean isWhite
          a boolean indicating if this player is white or black
protected  String ruleSet
          the rules under which this player is playing
 
Constructor Summary
protected AntichessAIPlayer(boolean isWhite, long whiteTimeInMillis, long blackTimeInMillis, String ruleSet)
           
 
Method Summary
 boolean addChattyPlayerListener(ChattyPlayerListener listener)
          adds a listener for this player's chat events
abstract  String getMove(String lastMove, long timeRemainingInMillis, long opponentTimeInMillis)
          This is the most important method that a subclass of this class will have to implement.
abstract  String getOpeningMove()
          If the player is white, then he must make the first move of the game.
 boolean removeChattyPlayerListener(ChattyPlayerListener listener)
          removes a listener from this player's chat events
protected  void sendChat(String message)
          a method that the player can call to send a message to his opponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isWhite

protected final boolean isWhite
a boolean indicating if this player is white or black


ruleSet

protected final String ruleSet
the rules under which this player is playing

Constructor Detail

AntichessAIPlayer

protected AntichessAIPlayer(boolean isWhite,
                            long whiteTimeInMillis,
                            long blackTimeInMillis,
                            String ruleSet)
Parameters:
isWhite - indicating if the player is white or black
whiteTimeInMillis - the amount of time, in milliseconds, that white will start with
blackTimeInMillis - the amount of time, in milliseconds, that black will start with
ruleSet - the set of rules by which the game will be played
Method Detail

getOpeningMove

public abstract String getOpeningMove()
If the player is white, then he must make the first move of the game. This method will only be invoked once to start the game if the player is white. This method will probably be fixed for most players.

Returns:
opening move for white player

getMove

public abstract String getMove(String lastMove,
                               long timeRemainingInMillis,
                               long opponentTimeInMillis)
This is the most important method that a subclass of this class will have to implement. When given the last move made by the opponent, the AI player must return his or her next move. The move will be expressed as a 4 character String, such as c2c3, indicating that the opponent just moved his piece from c2 to c3. Thus, the AI player is responsible for keeping track of the state of the board.

Parameters:
lastMove - String representation of the move expressed as 4 chars matching the following pattern: [a-h][1-8][a-h][1-8]
timeRemainingInMillis - the number of milliseconds that this AI player has left in the game to make his or her move
opponentTimeInMillis - the number of milliseconds that the opponent has left after making his or her last move

addChattyPlayerListener

public final boolean addChattyPlayerListener(ChattyPlayerListener listener)
adds a listener for this player's chat events


removeChattyPlayerListener

public final boolean removeChattyPlayerListener(ChattyPlayerListener listener)
removes a listener from this player's chat events


sendChat

protected final void sendChat(String message)
a method that the player can call to send a message to his opponent



Copyright © 2003 antichess.net. All Rights Reserved.