|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--utilities.Game
Holds a standard two player game. A game has several options. Strategic: not used by this class, but says whether the payoff depends on other players (this is not independently calculated by the class, you must set it). Stochastic: if the payoffs provided represent the mean of the payoffs returned or if the payoffs returned should be exactly the one in the matrix.
Constructor Summary | |
Game(boolean so)
Returns a game object. |
|
Game(boolean so,
MersenneTwister r)
Returns a game object. |
|
Game(int[][] m,
boolean so)
Returns a game object. |
|
Game(int[][] m,
boolean so,
MersenneTwister r)
Returns a game object. |
|
Game(int[][] m,
boolean so,
MersenneTwister r,
boolean st)
Returns a game object |
Method Summary | |
int |
getExpectedPayoff(int r)
Returns the expected payoff of strategy r against strategy 0. |
int |
getExpectedPayoff(int r,
int c)
Returns the expected payoff of strategy r against strategy c. |
int |
getHighestPayoff()
Tells you the highest possible value that will be returned. |
int[][] |
getMatrix()
Gets the payoff matrix |
double |
getNormPayoff(int r)
Returnes a normalized payoff as a double between 0 and 1 of r played against strategy 0. |
double |
getNormPayoff(int r,
int c)
Returnes a normalized payoff as a double between 0 and 1 of r played against strategy c. |
int |
getPayoff(int r)
Returns the payoff for strategy r against strategy 0, only usefully for non-strategic games. |
int |
getPayoff(int r,
int c)
Returns the payoff for strategy r against strategy c. |
double |
getProb(int r,
int p)
Tells you the probabiliy of receiving a particular payoff given that the player played strategy r against strategy 0. |
double |
getProb(int r,
int c,
int p)
Tells you the probability of receiving a particular payoff given that the player played strategy r against c. |
MersenneTwister |
getRandom()
Returns the random number generator used |
boolean |
getStochastic()
A function to determine if the game is stochastic. |
int |
getStrats()
Tells you the number of strategies |
boolean |
isStrategic()
A function to say if the game is marked as strategic. |
void |
setBigPayoff(int bp)
Sets the biggest possible payoff, and then recalculates the probabilites based on that. |
void |
setMatrix(int[][] m)
Sets the payoff matrix. |
void |
setMatrix(int[][] m,
int bp)
Sets the payoff matrix. |
void |
setRandom(MersenneTwister r)
Sets the random number generator |
void |
setStochastic(boolean s)
A function to set if the game is stochastic. |
void |
setStrategic(boolean st)
A function to set if the game is strategic. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Game(boolean so)
so
- a boolean to determine if the game is stochastic or notpublic Game(int[][] m, boolean so) throws ModelError
m
- is the matrix of the gameso
- is a boolean to determine if the game is stochstic or not
ModelError
- if there is a problem with the matrixpublic Game(int[][] m, boolean so, MersenneTwister r) throws ModelError
m
- the game matrixso
- a boolean to determin if the game is stochasticr
- the random number generator
ModelError
- if there is a problem with the matrixpublic Game(int[][] m, boolean so, MersenneTwister r, boolean st) throws ModelError
m
- the game matrixso
- a boolean to determine if the game is stochasticr
- the random number generatorst
- a boolean to determine if the game is strategic
ModelError
- if there is a problem with the matrixpublic Game(boolean so, MersenneTwister r)
so
- a boolean to determine if the game is stochasticr
- the random number generatorMethod Detail |
public void setStrategic(boolean st)
st
- A bolean to say if the game is strategic or notpublic boolean isStrategic()
public void setStochastic(boolean s)
s
- A boolean to say if the game is stochastic or notpublic boolean getStochastic()
public int[][] getMatrix()
public void setMatrix(int[][] m) throws ModelError
m
- A two dimensional integer array with the matrix
ModelError
- if the matrix is malformedpublic void setMatrix(int[][] m, int bp) throws ModelError
m
- The payoff matrixbp
- The bigest possible payoff (for stochastic games).
ModelError
- if there is a problem with the matrixpublic void setBigPayoff(int bp)
bp
- the big payoffpublic int getStrats()
public int getHighestPayoff()
public double getProb(int r, int c, int p)
r
- the player's strategyc
- the opponent's strategyp
- the payoff received
public double getProb(int r, int p)
r
- the player's strategyp
- the payoff received
public MersenneTwister getRandom()
public void setRandom(MersenneTwister r)
public int getPayoff(int r)
r
- the strategy employed
public int getPayoff(int r, int c)
r
- the strategy employedc
- the strategy of the opponent
public double getNormPayoff(int r)
r
- the strategy
public double getNormPayoff(int r, int c)
r
- the strategyc
- the opponent's strategy
public int getExpectedPayoff(int r)
r
- the strategy
public int getExpectedPayoff(int r, int c)
r
- the strategyc
- the opponent's strategy
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |