org.eclipse.palamedes.gdl.connection
Class Player

java.lang.Object
  extended by org.eclipse.palamedes.gdl.connection.Player

public class Player
extends java.lang.Object


Nested Class Summary
protected static class Player.RealMatch
           
 
Field Summary
protected  Player.RealMatch realMatch
           
protected static java.lang.String STR_ERROR1
           
 
Constructor Summary
Player()
           
 
Method Summary
protected  void checkMatchId(Message msg)
          This method is for error checking nothing more.
 java.lang.String commandPlay(Message msg)
          This method is called once for each move

msg = "(PLAY )
will be NIL for the first PLAY message and the list of the moves of all the players in the previous state
e.g. msg="(PLAY tictactoe1 NIL)" for the first PLAY message or msg="(PLAY tictactoe1 ((MARK 1 2) NOOP))" if white marked cell (1,2) and black did a "noop".
 void commandStart(Message msg)
          This method is called when a new match begins.
 void commandStop(Message msg)
          This method is called if the match is over msg="(STOP ) TODO: clean up the GamePlayer for the next match be happy if you have won, think about what went wrong if you have lost ;-)
 Player.RealMatch createRealMatch(java.lang.String matchId, IGame game, IStrategy strategy, java.lang.String role, int start, int play)
           
 double getExpectedGoalValue()
           
 double getReliabilityValue()
           
 java.lang.String getSlaveExtention()
           
protected  java.lang.String[] prepareMoves(Message msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STR_ERROR1

protected static final java.lang.String STR_ERROR1
See Also:
Constant Field Values

realMatch

protected Player.RealMatch realMatch
Constructor Detail

Player

public Player()
Method Detail

commandStart

public void commandStart(Message msg)
This method is called when a new match begins.

msg="(START <MATCH ID> <ROLE> <GAME DESCRIPTION> <STARTCLOCK> <PLAYCLOCK>)"
e.g. msg="(START tictactoe1 white ((role white) (role black) ...) 1800 120)" means: TODO: - use the time to "contemplate" about the game description and return on time (before STARTCLOCK is over!)


commandPlay

public java.lang.String commandPlay(Message msg)
This method is called once for each move

msg = "(PLAY )
will be NIL for the first PLAY message and the list of the moves of all the players in the previous state
e.g. msg="(PLAY tictactoe1 NIL)" for the first PLAY message or msg="(PLAY tictactoe1 ((MARK 1 2) NOOP))" if white marked cell (1,2) and black did a "noop".

TODO:
  • calculate the new state from the old one and the
  • use the time to find the best of your possible moves in the current state
  • return your move (instead of "NIL") on time (before PLAYCLOCK is over!)

Returns:
the move of this player

commandStop

public void commandStop(Message msg)
This method is called if the match is over msg="(STOP ) TODO:
  • clean up the GamePlayer for the next match
  • be happy if you have won, think about what went wrong if you have lost ;-)


checkMatchId

protected void checkMatchId(Message msg)
This method is for error checking nothing more.

Parameters:
msg -

prepareMoves

protected java.lang.String[] prepareMoves(Message msg)

getReliabilityValue

public double getReliabilityValue()

getExpectedGoalValue

public double getExpectedGoalValue()

getSlaveExtention

public java.lang.String getSlaveExtention()

createRealMatch

public Player.RealMatch createRealMatch(java.lang.String matchId,
                                        IGame game,
                                        IStrategy strategy,
                                        java.lang.String role,
                                        int start,
                                        int play)