|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--edu.stanford.multiagent.gamer.ParameterizedObject
|
+--edu.stanford.multiagent.gamer.Game
|
+--edu.stanford.multiagent.gamer.NPlayerPrisonersDilemma
Generate an instance of N-Player Prisoner's Dilemma game as follows. Let C(i) be the payoff if you cooperate and i others cooperate, and let D(i) be the payoff if you defect while i others cooperate, such that 1) D(i) > C(i) for 0 <= i <= n-1 2) D(i+1) > D(i) and also C(i+1) > C(i) for 0 <= i < n-1 3) C(i) > (D(i) + C(i-1)) / 2 for 0 < i <= n-1 For now this is done by using a linear function C(i) = Xc + Y D(i) = Xc + Z where 0 < Z - Y < X
| Field Summary |
| Fields inherited from class edu.stanford.multiagent.gamer.Game |
actions, DEFAULT_HIGH, DEFAULT_LOW, intMult, intPayoffs, players, pMaxPayoff, pMinPayoff, pNormalize, symActions |
| Fields inherited from class edu.stanford.multiagent.gamer.ParameterizedObject |
parameters |
| Constructor Summary | |
NPlayerPrisonersDilemma()
|
|
| Method Summary | |
protected void |
checkParameters()
Make sure that the parameters are in the proper range |
void |
doGenerate()
Generate the game |
protected java.lang.String |
getGameHelp()
Return help screen information about the given game class. |
java.util.Vector |
getPayoff(int[] outcome)
Return a Vector with all players' utilities at the given outcome |
double |
getPayoff(int[] outcome,
int player)
Return the payoff for the given player in the given outcome. |
void |
initialize()
Set the numbers of players and actions for the game, initilaize variables, and so on. |
void |
randomizeParameters()
Randomize parameters that were not set by the user |
| Methods inherited from class edu.stanford.multiagent.gamer.Game |
generate, getAutoNormPayoff, getDescription, getHelp, getName, getNormPayoff, getNumActions, getNumActions, getNumPlayers, getOutputPayoff, getOutputPayoff, getRangeHelp, parseActions, parsePlayersActions, parsePlayersSameNumberActions, parseSameNumberActions, setDescription, setName, setNormMinAndMax, setNumActions, setNumActions, setNumPlayers, writeGame |
| Methods inherited from class edu.stanford.multiagent.gamer.ParameterizedObject |
getBooleanParameter, getDoubleParameter, getLongParameter, getParamDescription, getParameter, getParameters, getStringParameter, setParameter, setParameter, setParameters, setParameters |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public NPlayerPrisonersDilemma()
throws java.lang.Exception
| Method Detail |
public void initialize()
throws java.lang.Exception
initialize in class Gamejava.lang.Exception
protected void checkParameters()
throws java.lang.Exception
checkParameters in class ParameterizedObjectjava.lang.Exception - if anything is wrong with the parameter
valuespublic void randomizeParameters()
randomizeParameters in class ParameterizedObject
public double getPayoff(int[] outcome,
int player)
getPayoff in class Gameoutcome - array of integers representing which actions
have been chosen by each playerplayer - the player whose payoff to returnpublic java.util.Vector getPayoff(int[] outcome)
getPayoff in class Gameoutcome - an array containing the action choices of
all players at the given outcomeprotected java.lang.String getGameHelp()
Game
getGameHelp in class Gamepublic void doGenerate()
doGenerate in class ParameterizedObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||