|
||||||||||
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.MajorityVoting
Generates an instance of the Majority Voting game. Subclasses Game directly without an intermediate layer. Note that in this version of the Majority Voting game, players' utilities for each candidate are arbitrary and it is possible that a player would be indifferent between two or more candidates. Also, in this version if two candidates have the same number of votes, the lower indexed candidate is declared winner.
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 | |
MajorityVoting()
|
Method Summary | |
protected void |
checkParameters()
Checks if Parameter values are consistent. |
void |
doGenerate()
Generate the game and store all of the players' utilities for each candidate in preferences matrix |
protected java.lang.String |
getGameHelp()
Return help screen information about the given game class. |
java.util.Vector |
getPayoff(int[] outcome)
Return a Vector with all players' utilities at the given outcome |
double |
getPayoff(int[] outcome,
int player)
Return the payoff for the given player in the given outcome. |
void |
initialize()
Initializes using preset parameter values |
void |
randomizeParameters()
Sets values of any unset parameters randomly. |
Methods inherited from class edu.stanford.multiagent.gamer.Game |
generate, getAutoNormPayoff, getDescription, getHelp, getName, getNormPayoff, getNumActions, getNumActions, getNumPlayers, getOutputPayoff, getOutputPayoff, 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 |
public MajorityVoting() throws java.lang.Exception
Method Detail |
public void initialize() throws java.lang.Exception
Game
initialize
in class Game
java.lang.Exception
protected void checkParameters() throws java.lang.Exception
ParameterizedObject
checkParameters
in class ParameterizedObject
java.lang.Exception
- if anything is wrong with the parameter
valuespublic void randomizeParameters()
ParameterizedObject
randomizeParameters
in class ParameterizedObject
public double getPayoff(int[] outcome, int player)
getPayoff
in class Game
outcome
- array of integers representing which actions
have been chosen by each playerplayer
- the player whose payoff to returnpublic java.util.Vector getPayoff(int[] outcome)
getPayoff
in class Game
outcome
- an array containing the action choices of
all players at the given outcomeprotected java.lang.String getGameHelp()
Game
getGameHelp
in class Game
public void doGenerate()
doGenerate
in class ParameterizedObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |