ipdlx
Class GameResultLog

java.lang.Object
  extended by ipdlx.GameResult
      extended by ipdlx.StandardGameResult
          extended by ipdlx.GameResultLog
All Implemented Interfaces:
PDValues

public class GameResultLog
extends StandardGameResult
implements PDValues

Log of the game. A exhaustive description of a game - what moves did players do, what was the result of every round. Usefull for strategy-testing purposes.

Author:
Tomasz Kaczanowski, Jan Humble

Field Summary
 
Fields inherited from class ipdlx.GameResult
nrRounds, payoffs, players
 
Fields inherited from interface ipdlx.PDValues
COOPERATE, DEFAULT_MISTAKE_LEVEL, DEFAULT_PUNISHMENT, DEFAULT_REWARD, DEFAULT_SUCKER, DEFAULT_TEMPTATION, DEFECT, EXIT, moves, PLAYER_A, PLAYER_B
 
Constructor Summary
GameResultLog(int nbOfRounds, java.lang.String[] strategies)
          constructor.
 
Method Summary
 void createStatistics()
          creates statistics based on game log
 int getCoCoNumber()
           
 float getCoCoPercent()
           
 int getCoDeNumber()
           
 float getCoDePercent()
           
 int getDeDeNumber()
           
 float getDeDePercent()
           
 double[][] getLog()
          returns game log (for both players)
 double[] getLogPlayer(int playerNb)
          returns game log for one player
 int getNbOfRounds()
          returns number of rounds in this game
 java.lang.String toString()
           
 void writeMove(int nbOfRound, int player, double move)
          write type of move made by players to game log
 
Methods inherited from class ipdlx.StandardGameResult
addPayoff, getPlayerA, getPlayerB
 
Methods inherited from class ipdlx.GameResult
addPayoff, getPayoffPlayer, getPayoffs, getPlayer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GameResultLog

public GameResultLog(int nbOfRounds,
                     java.lang.String[] strategies)
constructor.

Parameters:
nbOfRounds - number of rounds in this game
strategies - - names of strategies for both players
Method Detail

writeMove

public void writeMove(int nbOfRound,
                      int player,
                      double move)
write type of move made by players to game log

Overrides:
writeMove in class GameResult
Parameters:
nbOfRound - - which round is this
player - - which player A or B
move - - type of move of player - COOPERATION or DEFECTION

getLog

public double[][] getLog()
returns game log (for both players)

Overrides:
getLog in class GameResult
Returns:
game log

getLogPlayer

public double[] getLogPlayer(int playerNb)
returns game log for one player

Parameters:
playerNb - player A or B
Returns:
game log for one player

createStatistics

public void createStatistics()
creates statistics based on game log


getCoCoPercent

public float getCoCoPercent()
Returns:
percent of rounds when both players played COOPERATE

getCoDePercent

public float getCoDePercent()
Returns:
percent of rounds when one player played COOPERATE and the other DEFECT

getDeDePercent

public float getDeDePercent()
Returns:
percent of rounds when both players played DEFECT

getCoCoNumber

public int getCoCoNumber()
Returns:
number of roundse when both players played COOPERATE

getCoDeNumber

public int getCoDeNumber()
Returns:
number of rounds when one player played COOPERATE and the other DEFECT

getDeDeNumber

public int getDeDeNumber()
Returns:
number of roundse when both players played DEFECT

getNbOfRounds

public int getNbOfRounds()
returns number of rounds in this game

Returns:
number of rounds in this game

toString

public java.lang.String toString()
Overrides:
toString in class GameResult