ipdlx
Class StandardGame

java.lang.Object
  extended by ipdlx.Game
      extended by ipdlx.StandardGame
All Implemented Interfaces:
PDValues

public class StandardGame
extends Game

Standard 2 player game

Author:
Tomasz Kaczanowski, Jan Humble

Field Summary
protected  Player playerA
          first player
protected  Player playerB
          second player
 
Fields inherited from class ipdlx.Game
broadcastResult, broadcastRoundResults, gameListeners, gameMatrix, gameResult, moveTimeLimit, players, probabilityOfMistake, stDev
 
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
StandardGame()
          Constructs a standard game, playing 200 rounds with the default game matrix.
StandardGame(Game game)
          Constructs a new game with the same game parameters as the given one.
StandardGame(int nrOfRounds, GameMatrix gameMatrix)
          constructor
StandardGame(int nrOfRounds, GameMatrix gameMatrix, float noise)
          constructor
 
Method Summary
 Player getPlayerA()
           
 Player getPlayerB()
           
 GameResult play()
          plays the game and return the results of it
 void setPlayerA(Player playerA)
          sets the first player
 void setPlayerB(Player playerB)
          sets the second player
 
Methods inherited from class ipdlx.Game
addGameListener, addPlayer, addPlayers, broadcastGameStart, broadcastResults, broadcastRoundResults, filterMove, getBroadcastResult, getBroadcastRoundResults, getGameListeners, getGameMatrix, getNrRoundsStDev, getNumberOfRounds, getNumberOfRounds, getNumberOfRoundsStDev, getProbabilityOfMistake, getStrategyMove, getStrategyMove, removeGameListener, setBroadcastResult, setBroadcastRoundResults, setGameMatrix, setMoveTimeLimit, setNrRoundsStDev, setNumberOfRounds, setPlayers, setProbabilityOfMistake, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

playerA

protected Player playerA
first player


playerB

protected Player playerB
second player

Constructor Detail

StandardGame

public StandardGame(Game game)
Constructs a new game with the same game parameters as the given one. Also, all game listeners are transferred.

Parameters:
game - a template game to copy parameters from

StandardGame

public StandardGame()
Constructs a standard game, playing 200 rounds with the default game matrix.


StandardGame

public StandardGame(int nrOfRounds,
                    GameMatrix gameMatrix)
constructor

Parameters:
nrOfRounds - number of iterations
gameMatrix - matrix of the prisoner's dilemma game

StandardGame

public StandardGame(int nrOfRounds,
                    GameMatrix gameMatrix,
                    float noise)
constructor

Parameters:
nrOfRounds - number of iterations
gameMatrix - matrix of the prisoner's dilemma game
noise - probability of mistake
Method Detail

setPlayerA

public final void setPlayerA(Player playerA)
sets the first player

Parameters:
playerA - first player of this game

getPlayerA

public final Player getPlayerA()

getPlayerB

public final Player getPlayerB()

setPlayerB

public void setPlayerB(Player playerB)
sets the second player

Parameters:
playerB - second player of this game

play

public GameResult play()
plays the game and return the results of it

Overrides:
play in class Game
Returns:
result of the game