|
||||||||||
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.GraphicalGame
Abstract class implements the basic common features of graphical games. The graphical game may have data stored at either edges or at the nodes. If data is at the nodes, this data would be in the form of a matrix of payoffs for one players based on actions of all connected players. If the data is at the edges it would be in the form of 2 person games which are added to the node data to get the payoff.
Field Summary | |
protected edu.stanford.multiagent.gamer.graphs.ALGraph |
graph
|
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 | |
GraphicalGame()
Constructor for new graphical games. |
Method Summary | |
protected void |
addEdge(int player1,
int player2)
Adds an edge from player1 to player2 but leaves the data for the edge set to null. |
protected void |
addEdge(int player1,
int player2,
edu.stanford.multiagent.gamer.DoubleTensor matrix)
Adds an edge from player1 to player2 if the player numbers are valid, and sets the matrix at the edge to the one given. |
double |
getPayoff(int[] outcome,
int player)
Figures out payoff for a certain outcome by adding up a) the payoff from the matrix that is stored at the player's node if one exists b) payoffs from all of the matrices which are connected by edges to the node of a certain player, if any of those exist |
protected abstract void |
initGraph()
Creates and initializes a graph of the correct type. |
void |
setNodeMatrix(int player,
edu.stanford.multiagent.gamer.DoubleTensor matrix)
Sets the matrix for the player's node if using the version of the graphical game representation in which the payoffs are stored in matrices at the nodes (as opposed to only on edges). |
void |
writeGame(java.io.PrintWriter out)
Writes output as a graphical game. |
Methods inherited from class edu.stanford.multiagent.gamer.Game |
generate, getAutoNormPayoff, getDescription, getGameHelp, getHelp, getName, getNormPayoff, getNumActions, getNumActions, getNumPlayers, getOutputPayoff, getOutputPayoff, getPayoff, getRangeHelp, initialize, parseActions, parsePlayersActions, parsePlayersSameNumberActions, parseSameNumberActions, setDescription, setName, setNormMinAndMax, setNumActions, setNumActions, setNumPlayers |
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 edu.stanford.multiagent.gamer.graphs.ALGraph graph
Constructor Detail |
public GraphicalGame() throws java.lang.Exception
Method Detail |
protected void addEdge(int player1, int player2) throws java.lang.Exception
player1
- the player node at which the edge should originateplayer2
- the player node at which the edge should end
java.lang.Exception
protected void addEdge(int player1, int player2, edu.stanford.multiagent.gamer.DoubleTensor matrix) throws java.lang.Exception
player1
- the player node at which the edge should originateplayer2
- the player node at which the edge should endmatrix
- the tensor to store on the edge
java.lang.Exception
- if the tensor is invalid, if an edge from
player1 to player2 already exists, or if the player numbers are
invalidpublic void setNodeMatrix(int player, edu.stanford.multiagent.gamer.DoubleTensor matrix)
player
- the player whose node the data should be
stored atmatrix
- the tensor to store at this nodepublic double getPayoff(int[] outcome, int player)
getPayoff
in class Game
outcome
- an array containing the actions chosen by
each playerplayer
- the player whose payoff should be returnedprotected abstract void initGraph() throws java.lang.Exception
java.lang.Exception
public void writeGame(java.io.PrintWriter out)
writeGame
in class Game
out
- the PrintWriter to which the output should be written
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |