edu.stanford.multiagent.gamer
Class TimingGame

java.lang.Object
  |
  +--edu.stanford.multiagent.gamer.ParameterizedObject
        |
        +--edu.stanford.multiagent.gamer.Game
              |
              +--edu.stanford.multiagent.gamer.TimingGame
Direct Known Subclasses:
GrabTheDollar, MinimumEffortGame, TravelersDilemma, WarOfAttrition

public abstract class TimingGame
extends Game

Abstract class implements common features among timing games. For the extents and purposes of this class, "timing game" can refer to any game in which the payoff is computed using a function of the "earliest" (lowest numbered) action chosen, your own action, and whether your action came first, tied for first, or came later.


Nested Class Summary
static class TimingGame.TimingGameParams
          TimingGameParams is a simple helper class used to store all of the parameters for the Timing Game function for one particular player.
 
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
TimingGame()
          Constructor for a new timing game.
 
Method Summary
 double getPayoff(int[] outcome, int player)
          Returns the payoff for the given player in the given outcome using the common timing game parameterized function.
 void setParamsNoTies(TimingGame.TimingGameParams[] lowParams, TimingGame.TimingGameParams[] notLowParams)
          Set the parameters for the payoff functions for the case when the player has the lowest time and for when the player does not.
 void setParamsWithTie(TimingGame.TimingGameParams[] lowParams, TimingGame.TimingGameParams[] tiedParams, TimingGame.TimingGameParams[] notLowParams)
          Sets the parameters for the payoff functions for the case when the player has the lowest time, the case when the player is tied, and the case when the player does not have the lowest time.
 
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

TimingGame

public TimingGame()
           throws java.lang.Exception
Constructor for a new timing game.

Method Detail

setParamsWithTie

public void setParamsWithTie(TimingGame.TimingGameParams[] lowParams,
                             TimingGame.TimingGameParams[] tiedParams,
                             TimingGame.TimingGameParams[] notLowParams)
Sets the parameters for the payoff functions for the case when the player has the lowest time, the case when the player is tied, and the case when the player does not have the lowest time. If ties are not allowed, use setParamsNoTies instead.

Parameters:
lowParams - parameter settings for calculating payoff in the case when a player is the only one with the lowest time
tiedParams - parameter settings for calculating payoff in the case when a player is tied for the lowest time

setParamsNoTies

public void setParamsNoTies(TimingGame.TimingGameParams[] lowParams,
                            TimingGame.TimingGameParams[] notLowParams)
Set the parameters for the payoff functions for the case when the player has the lowest time and for when the player does not. Use this function if ties are not allowed.

Parameters:
lowParams - parameter settings for calculating payoff in the case when a player is the only one with the lowest time

getPayoff

public double getPayoff(int[] outcome,
                        int player)
Returns the payoff for the given player in the given outcome using the common timing game parameterized function. Assumes all parameters have already been properly set up.

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