com.anji.roshambo
Class AnjiNetRoshamboPlayer

java.lang.Object
  extended bycom.anji.roshambo.AnjiNetRoshamboPlayer
All Implemented Interfaces:
IteratedPlayer, Player, RoshamboPlayer

public class AnjiNetRoshamboPlayer
extends java.lang.Object
implements RoshamboPlayer

Author:
Philip Tucker

Field Summary
 
Fields inherited from interface com.anji.roshambo.RoshamboPlayer
DRAW, LOSS, PAPER, ROCK, SCISSORS, WIN
 
Constructor Summary
AnjiNetRoshamboPlayer(AnjiNet aNet)
           
AnjiNetRoshamboPlayer(AnjiNet aNet, int anActivationCycles)
           
AnjiNetRoshamboPlayer(AnjiNet aNet, java.util.Random aRand)
           
AnjiNetRoshamboPlayer(AnjiNet aNet, java.util.Random aRand, int anActivationCycles, int aHistorySize)
          Must have at least 6 inputs.
 
Method Summary
 java.lang.String getAuthor()
           
 java.lang.String getPlayerId()
           
 int nextMove()
          Produce your next move.
 void reset()
          reset player state; after a call to reset, the player should be in the same state as it was when created; i.e., it has no memory of previous games played
 void reset(int aTrials)
          Initialize a new match against an unknown opponent.
 void storeMove(int aMove, int aScore)
          Store the opponent's choice and the outcome of the latest move.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnjiNetRoshamboPlayer

public AnjiNetRoshamboPlayer(AnjiNet aNet,
                             java.util.Random aRand,
                             int anActivationCycles,
                             int aHistorySize)
Must have at least 6 inputs. Inputs 0-2 correspond to rock, scissors, paper. Each move the network is activated with one of rock scissors or paer at 1.0 and the rest at 0.0. Input 3 corresponds to previous move results (WIN,LOSS, DRAW). Input 4 is hourglass, and input 5 is bias. Must have at least 3 outputs. Outputs 0-2 are rock, scissors, paper, values between 0 and 1 (inclusive) indicating affinity for each.

Parameters:
aNet -
aRand - if null, player deterministically chooses each move as the maximum output of the net; otherwise, each move is chosen as a weighted probability based on each output
anActivationCycles - number of cycles network is activated for each move
aHistorySize - number of previous moves to input to net each cycle

AnjiNetRoshamboPlayer

public AnjiNetRoshamboPlayer(AnjiNet aNet)
Parameters:
aNet -
See Also:
AnjiNetRoshamboPlayer(AnjiNet, int)

AnjiNetRoshamboPlayer

public AnjiNetRoshamboPlayer(AnjiNet aNet,
                             java.util.Random aRand)
Parameters:
aNet -
aRand -
See Also:
AnjiNetRoshamboPlayer(AnjiNet, Random, int, int)

AnjiNetRoshamboPlayer

public AnjiNetRoshamboPlayer(AnjiNet aNet,
                             int anActivationCycles)
Parameters:
aNet -
anActivationCycles -
See Also:
AnjiNetRoshamboPlayer(AnjiNet, Random, int, int)
Method Detail

reset

public void reset(int aTrials)
Description copied from interface: RoshamboPlayer
Initialize a new match against an unknown opponent. The length of the match is specified in the paramater "trials". This function is always called before any match is played.

Specified by:
reset in interface RoshamboPlayer
Parameters:
aTrials -
See Also:
RoshamboPlayer.reset(int)

reset

public void reset()
Description copied from interface: Player
reset player state; after a call to reset, the player should be in the same state as it was when created; i.e., it has no memory of previous games played

Specified by:
reset in interface Player
See Also:
Player.reset()

storeMove

public void storeMove(int aMove,
                      int aScore)
Description copied from interface: RoshamboPlayer
Store the opponent's choice and the outcome of the latest move. This function is called after every move. move is one of ROCK, PAPER, SCISSORS. score is one of DRAW, WIN, LOSS.

Specified by:
storeMove in interface RoshamboPlayer
Parameters:
aMove -
aScore -
See Also:
RoshamboPlayer.storeMove(int, int)

nextMove

public int nextMove()
Description copied from interface: RoshamboPlayer
Produce your next move.

Specified by:
nextMove in interface RoshamboPlayer
Returns:
one of ROCK, PAPER, SISSORS
See Also:
RoshamboPlayer.nextMove()

getPlayerId

public java.lang.String getPlayerId()
Specified by:
getPlayerId in interface RoshamboPlayer
Returns:
the name (and version) of this subject.
See Also:
Player.getPlayerId()

toString

public java.lang.String toString()
See Also:
Object.toString()

getAuthor

public java.lang.String getAuthor()
Specified by:
getAuthor in interface RoshamboPlayer
Returns:
the author's name of this subject.
See Also:
RoshamboPlayer.getAuthor()