|
||||||||||
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
Abstract class that describes the basic game entity.
Field Summary | |
protected static Parameters.ParamInfo |
actions
|
protected static double |
DEFAULT_HIGH
|
protected static double |
DEFAULT_LOW
|
protected static Parameters.ParamInfo |
intMult
|
protected static Parameters.ParamInfo |
intPayoffs
|
protected static Parameters.ParamInfo |
players
|
protected static Parameters.ParamInfo |
pMaxPayoff
|
protected static Parameters.ParamInfo |
pMinPayoff
|
protected static Parameters.ParamInfo |
pNormalize
|
protected static Parameters.ParamInfo |
symActions
|
Fields inherited from class edu.stanford.multiagent.gamer.ParameterizedObject |
parameters |
Constructor Summary | |
protected |
Game()
The consctructor. |
Method Summary | |
void |
generate()
The generate interface. |
double |
getAutoNormPayoff(int[] outcome,
int player)
Formats automatically to normalization between 0 and 1 with double payoffs, regardless of parameters. |
java.lang.String |
getDescription()
Returns Game Description (Name, Params, etc) |
protected abstract java.lang.String |
getGameHelp()
Return help screen information about the given game class. |
java.lang.String |
getHelp()
Returns the help screen |
java.lang.String |
getName()
Returns just the name of the game. |
double |
getNormPayoff(int[] outcome,
int player)
Formats and outputs the payoff after normalization according to set flags. |
int[] |
getNumActions()
Returns an array containing the number of actions that each player has. |
int |
getNumActions(int player)
Returns the number of actions of the given player or a vector of Integers with the numbers of actions. |
int |
getNumPlayers()
Returns the number of players in this game |
java.lang.String |
getOutputPayoff(double payoff)
Formats and outputs a payoff value according to set flags. |
java.lang.String |
getOutputPayoff(int[] outcome,
int player)
Formats and outputs the payoff according to set flags. |
java.util.Vector |
getPayoff(int[] outcome)
Collects payoffs into a vector. |
abstract double |
getPayoff(int[] outcome,
int player)
Returns a payoff for a given player. |
java.lang.String |
getRangeHelp()
Adds range help information to games which use the range DEFAULT_LOW through DEFAULT_HIGH. |
void |
initialize()
Initializes using preset parameter values |
protected void |
parseActions()
Parses only the parameter for the number of actions, allowing either the same number for all players, or different numbers for each. |
protected void |
parsePlayersActions()
Parses action/player parameters and sets them. |
protected void |
parsePlayersSameNumberActions()
Parses action/player parameters and sets them. |
protected void |
parseSameNumberActions()
Parses only the parameter for number of actions. |
protected void |
setDescription(java.lang.String description)
Sets the description string for the game which will be output as part of the help string. |
protected void |
setName(java.lang.String name)
Sets the name of the game. |
void |
setNormMinAndMax()
Collects all payoffs (one at a time) and figures out the min and max. |
protected void |
setNumActions(int nActions)
Sets same number of actions for each player. |
protected void |
setNumActions(int[] nActions)
Sets the number of actions for each player when each player may have a different number of actions. |
protected void |
setNumPlayers(int nPlayers)
Sets the number of players in the game. |
void |
writeGame(java.io.PrintWriter out)
Writes output in the format specific to this game. |
Methods inherited from class edu.stanford.multiagent.gamer.ParameterizedObject |
checkParameters, doGenerate, getBooleanParameter, getDoubleParameter, getLongParameter, getParamDescription, getParameter, getParameters, getStringParameter, randomizeParameters, setParameter, setParameter, setParameters, setParameters |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final double DEFAULT_LOW
protected static final double DEFAULT_HIGH
protected static Parameters.ParamInfo players
protected static Parameters.ParamInfo actions
protected static Parameters.ParamInfo symActions
protected static Parameters.ParamInfo intPayoffs
protected static Parameters.ParamInfo intMult
protected static Parameters.ParamInfo pMinPayoff
protected static Parameters.ParamInfo pMaxPayoff
protected static Parameters.ParamInfo pNormalize
Constructor Detail |
protected Game() throws java.lang.Exception
java.lang.Exception
Method Detail |
public java.lang.String getDescription()
getDescription
in class ParameterizedObject
protected void setDescription(java.lang.String description)
description
- a description of the gamepublic java.lang.String getName()
protected void setName(java.lang.String name)
name
- the name of the class of games generated by
a given game classpublic int getNumPlayers()
protected void setNumPlayers(int nPlayers)
nPlayers
- the number of playerspublic int getNumActions(int player)
player
- the index of the player whose actions should
be returnedpublic int[] getNumActions()
protected void setNumActions(int nActions) throws java.lang.Exception
nActions
- the number of actions each player has
java.lang.Exception
protected void setNumActions(int[] nActions) throws java.lang.Exception
nActions
- an array containing the number of actions each
player has
java.lang.Exception
public void writeGame(java.io.PrintWriter out) throws java.lang.UnsupportedOperationException
out
- a PrintWriter to which output can be written
java.lang.UnsupportedOperationException
- if the given game subclass
does not support proprietary outputpublic void initialize() throws java.lang.Exception
initialize
in class ParameterizedObject
java.lang.Exception
public java.lang.String getHelp()
getHelp
in class ParameterizedObject
public java.lang.String getRangeHelp()
public void generate() throws java.lang.Exception
java.lang.Exception
protected void parseActions() throws java.lang.Exception
java.lang.Exception
protected void parsePlayersActions() throws java.lang.Exception
java.lang.Exception
protected void parseSameNumberActions() throws java.lang.Exception
java.lang.Exception
- if it is not the case that all players have the
same number of actionsprotected void parsePlayersSameNumberActions() throws java.lang.Exception
java.lang.Exception
- if it is not the case that all players have the
same number of actionspublic java.util.Vector getPayoff(int[] outcome)
outcome
- an array containing the action choices of
all players at the given outcomepublic void setNormMinAndMax()
Note that only base double max and min values are calculated here, not the converted integer max and min.
public java.lang.String getOutputPayoff(int[] outcome, int player) throws java.lang.Exception
outcome
- an array containing all players' action
choices at the given outcomeplayer
- tha player whose payoff should be returned
java.lang.Exception
public java.lang.String getOutputPayoff(double payoff) throws java.lang.Exception
payoff
- the value of the payoff to be formatted
java.lang.Exception
public double getNormPayoff(int[] outcome, int player)
outcome
- an array containing all players' action
choices at the given outcomeplayer
- tha player whose payoff should be returnedpublic double getAutoNormPayoff(int[] outcome, int player)
outcome
- an array containing all players' action
choices at the given outcomeplayer
- tha player whose payoff should be returnedpublic abstract double getPayoff(int[] outcome, int player)
outcome
- array of integers representing which actions
have been chosen by each playerplayer
- the player whose payoff to returnprotected abstract java.lang.String getGameHelp()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |