ipdlx
Class PlayerMatrix

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

public class PlayerMatrix
extends java.lang.Object
implements PDValues

payoff matrix for a player. This class has two purposes: 1) helps create game matrices 2) allows to easily print out the matrix for one player

Author:
Tomek Kaczanowski

Field Summary
protected  double[][] matrix
          2x2 matrix of payoffs for one player
 
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
PlayerMatrix(double[][] matrix)
           
PlayerMatrix(double reward, double sucker, double temptation, double punishment)
          constructor
 
Method Summary
 double[][] getMatrix()
           
 java.lang.String toString()
          Prints out player's payoffs
 PlayerMatrix transpose()
          takes PlayerMatrix and changes places of temptation and sucker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

matrix

protected double[][] matrix
2x2 matrix of payoffs for one player

Constructor Detail

PlayerMatrix

public PlayerMatrix(double reward,
                    double sucker,
                    double temptation,
                    double punishment)
constructor

Parameters:
reward - - reward for cooperation
sucker - - sucker's payoff
temptation - - temptation to defect
punishment - - punishment (for mutual defection)

PlayerMatrix

public PlayerMatrix(double[][] matrix)
Method Detail

getMatrix

public double[][] getMatrix()
Returns:
matrix with player's payoffs

toString

public java.lang.String toString()
Prints out player's payoffs

Overrides:
toString in class java.lang.Object
Returns:
String with nicely formatted matrix

transpose

public PlayerMatrix transpose()
takes PlayerMatrix and changes places of temptation and sucker. usefull for creating symmetrical game matrices

Returns:
PlayerMatrix with changed places of temptation and sucker