edu.stanford.multiagent.gamer
Class MatrixGame

java.lang.Object
  |
  +--edu.stanford.multiagent.gamer.ParameterizedObject
        |
        +--edu.stanford.multiagent.gamer.Game
              |
              +--edu.stanford.multiagent.gamer.MatrixGame
Direct Known Subclasses:
BattleOfTheSexes, Chicken, CovariantGame, HawkAndDove, PrisonersDilemma, RandomGame, ShapleysGame, TwoByTwoGame

public abstract class MatrixGame
extends Game

Class implements the straightforward normal form game.


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
MatrixGame()
          Constructor for a new matrix game.
 
Method Summary
 double getPayoff(int[] outcome, int player)
          Returns the payoff for a player for a given outcome.
protected  void initMatrix()
          Initializes the payoff array.
protected  void setPayoff(int[] outcome, int player, double value)
          Sets the payoff for a player for a given outcome.
 
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, writeGame
 
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
 

Constructor Detail

MatrixGame

public MatrixGame()
           throws java.lang.Exception
Constructor for a new matrix game.

Method Detail

initMatrix

protected void initMatrix()
Initializes the payoff array. Assumes that the numbers of players and actions have already been set.


getPayoff

public double getPayoff(int[] outcome,
                        int player)
Returns the payoff for a player for a given outcome.

Specified by:
getPayoff in class Game
Parameters:
outcome - an array containing the actions chosen by each player
player - the player whose payoff should be returned.

setPayoff

protected void setPayoff(int[] outcome,
                         int player,
                         double value)
Sets the payoff for a player for a given outcome.

Parameters:
outcome - an array containing the actions chosen by each player
player - the player whose payoff should be returned.
value - the amount of the payoff