ipdlx
Class PlayerMatrix
java.lang.Object
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 |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
matrix
protected double[][] matrix
- 2x2 matrix of payoffs for one player
PlayerMatrix
public PlayerMatrix(double reward,
double sucker,
double temptation,
double punishment)
- constructor
- Parameters:
reward - -
reward for cooperationsucker - -
sucker's payofftemptation - -
temptation to defectpunishment - -
punishment (for mutual defection)
PlayerMatrix
public PlayerMatrix(double[][] matrix)
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