edu.stanford.multiagent.gamer
Class GreedyGame

java.lang.Object
  |
  +--edu.stanford.multiagent.gamer.ParameterizedObject
        |
        +--edu.stanford.multiagent.gamer.Game
              |
              +--edu.stanford.multiagent.gamer.GeometricGame
                    |
                    +--edu.stanford.multiagent.gamer.GreedyGame

public class GreedyGame
extends GeometricGame

Return a version of the Greedy 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
GreedyGame()
           
 
Method Summary
 double calculatePayoff(int player, java.util.BitSet R, java.util.BitSet B, java.util.BitSet intersection)
          All geometric games must provide a function to calculate the payoff for each player based on the sets chosen and the intersection between them.
protected  void checkParameters()
          Checks if Parameter values are consistent.
 void doGenerate()
          Generate game, set all variables so that payoffs can be calculated when they are needed.
protected  java.lang.String getGameHelp()
          Return help screen information about the given game class.
 void initialize()
          Initializes using preset parameter values
 void randomizeParameters()
          Sets values of any unset parameters randomly.
 
Methods inherited from class edu.stanford.multiagent.gamer.GeometricGame
getGeoNumActions, getPayoff, initVariables
 
Methods inherited from class edu.stanford.multiagent.gamer.Game
generate, getAutoNormPayoff, getDescription, getHelp, getName, getNormPayoff, getNumActions, getNumActions, getNumPlayers, getOutputPayoff, getOutputPayoff, getPayoff, 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

GreedyGame

public GreedyGame()
           throws java.lang.Exception
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Description copied from class: Game
Initializes using preset parameter values

Overrides:
initialize in class Game
Throws:
java.lang.Exception

checkParameters

protected void checkParameters()
                        throws java.lang.Exception
Description copied from class: ParameterizedObject
Checks if Parameter values are consistent. Must be implemented by every non-abstract subclass of ParameterizedObject.

Specified by:
checkParameters in class ParameterizedObject
Throws:
java.lang.Exception - if anything is wrong with the parameter values

randomizeParameters

public void randomizeParameters()
Description copied from class: ParameterizedObject
Sets values of any unset parameters randomly. Can and should be overridden in subclasses to handle a non-uniform distribution and for constraints on parameters.

Overrides:
randomizeParameters in class ParameterizedObject

getGameHelp

protected java.lang.String getGameHelp()
Description copied from class: Game
Return help screen information about the given game class.

Specified by:
getGameHelp in class Game

calculatePayoff

public double calculatePayoff(int player,
                              java.util.BitSet R,
                              java.util.BitSet B,
                              java.util.BitSet intersection)
All geometric games must provide a function to calculate the payoff for each player based on the sets chosen and the intersection between them. In this case, if the intersection is nonempty, the payoff to both players will be 0. If it is empty, the payoff to player 2 will be the number of elements in the set player 2 has chosen, while the payoff to player 1 will be the negation of this.

Specified by:
calculatePayoff in class GeometricGame
Parameters:
player - the player whose payoff should be returned
R - the set chosen by player 1
B - the set chosen by player 2
intersection - the intersection of the sets chosen by players 1 and 2

doGenerate

public void doGenerate()
Generate game, set all variables so that payoffs can be calculated when they are needed.

Specified by:
doGenerate in class ParameterizedObject