edu.princeton.repeatedgames.rgsolve.games
Class Game

java.lang.Object
  extended by edu.princeton.repeatedgames.rgsolve.games.Game
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ArmsRace, BertrandImperfectSubs, BertrandPerfectSubs, BimatrixGame, CournotGame, GrabTheDollar, TempGameHolder

public abstract class Game
extends java.lang.Object
implements java.io.Serializable

An abstract class representing a repeated game

See Also:
Serialized Form

Field Summary
private static double DEFAULT_DELTA
          default discount rate
private  double delta
          discount, initialized to DEFAULT_DELTA
 java.lang.String description
          notes on or description of a game
static java.lang.String extension
          the file extension of the serialized game object
private  int m1
          number of player 1 actions
private  int m2
          number of player 2 actions
private static long serialVersionUID
          Serialization ID
private  BitSetFixed usableActions
          actions profiles that are usable in equilibrium
 
Constructor Summary
Game(int m1, int m2, double delta)
          super Constructor
Game(int m1, int m2, double delta, BitSetFixed usableActions)
          super Constructor
Game(int m1, int m2, double delta, BitSetFixed usableActions, java.lang.String description)
          super Constructor
Game(int m1, int m2, double delta, java.lang.String description)
          super Constructor
 
Method Summary
 boolean actionUsable(int a1, int a2)
          whether the action profile (a1, a2) is usable
 BitSetFixed copyUsableActions()
           
 double delta()
          accessor for delta
 int m(int player)
          The number of actions to player player, where 0 is player one and anything else is player 2
 int m1()
          accessor for m1
 int m2()
          accessor for m2
 double payoff(int player, int a1, int a2)
          payoff to player player, where 0 is player one and anything else is player 2
abstract  double payoff1(int a1, int a2)
          payoff to player 1
abstract  double payoff2(int a1, int a2)
          payoff to player 2
 void setActionUsable(int a1, int a2, boolean isUsable)
          Sets whether the action profile (a1,a2) is usable in equilibrium
protected  void setDescription(java.lang.String description)
          Sets the game descriptions string
 void setDiscount(double delta)
          Initializes the discount rate delta
private  void setNumActions(int m1, int m2)
          Initializes the number of actions in this game
private  void setUsableActions(BitSetFixed usableActions)
          sets the usable actions
 boolean usableActionsDefined()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serialization ID

See Also:
Constant Field Values

DEFAULT_DELTA

private static final double DEFAULT_DELTA
default discount rate

See Also:
Constant Field Values

extension

public static final java.lang.String extension
the file extension of the serialized game object

See Also:
Constant Field Values

description

public java.lang.String description
notes on or description of a game


delta

private double delta
discount, initialized to DEFAULT_DELTA


m1

private int m1
number of player 1 actions


m2

private int m2
number of player 2 actions


usableActions

private BitSetFixed usableActions
actions profiles that are usable in equilibrium

Constructor Detail

Game

public Game(int m1,
            int m2,
            double delta,
            BitSetFixed usableActions,
            java.lang.String description)
super Constructor

Parameters:
m1 - number of player 1 actions
m2 - number of player 2 actions
delta - discount rate
usableActions - usable action profile vector
description - game notes

Game

public Game(int m1,
            int m2,
            double delta)
super Constructor

Parameters:
m1 - number of player 1 actions
m2 - number of player 2 actions
delta - discount rate

Game

public Game(int m1,
            int m2,
            double delta,
            BitSetFixed usableActions)
super Constructor

Parameters:
m1 - number of player 1 actions
m2 - number of player 2 actions
delta - discount rate
usableActions - usable action profile vector

Game

public Game(int m1,
            int m2,
            double delta,
            java.lang.String description)
super Constructor

Parameters:
m1 - number of player 1 actions
m2 - number of player 2 actions
delta - discount rate
description - game notes
Method Detail

setDescription

protected void setDescription(java.lang.String description)
Sets the game descriptions string

Parameters:
description -

setUsableActions

private void setUsableActions(BitSetFixed usableActions)
sets the usable actions

Parameters:
usableActions -

setDiscount

public void setDiscount(double delta)
Initializes the discount rate delta

Parameters:
delta -

setNumActions

private void setNumActions(int m1,
                           int m2)
Initializes the number of actions in this game

Parameters:
m1 - number of player 1 actions
m2 - number of player 2 actions

actionUsable

public boolean actionUsable(int a1,
                            int a2)
whether the action profile (a1, a2) is usable

Parameters:
a1 - action for player 1
a2 - action for player 2
Returns:
whether the action profile (a1, a2) is usable

payoff

public double payoff(int player,
                     int a1,
                     int a2)
payoff to player player, where 0 is player one and anything else is player 2

Parameters:
a1 - player 1 action
a2 - player 2 action
Returns:
the payoff to player player

payoff1

public abstract double payoff1(int a1,
                               int a2)
payoff to player 1

Parameters:
a1 - player 1 action
a2 - player 2 action
Returns:
the payoff to player 1

payoff2

public abstract double payoff2(int a1,
                               int a2)
payoff to player 2

Parameters:
a1 - player 1 action
a2 - player 2 action
Returns:
the payoff to player 2

m

public int m(int player)
The number of actions to player player, where 0 is player one and anything else is player 2

Parameters:
player -
Returns:

m1

public int m1()
accessor for m1

Returns:
the number of player 1 actions m1

m2

public int m2()
accessor for m2

Returns:
the number of player 2 actions m2

delta

public double delta()
accessor for delta

Returns:
the discount rate delta

usableActionsDefined

public boolean usableActionsDefined()
Returns:
whether the usableActions bit set is not null

copyUsableActions

public BitSetFixed copyUsableActions()
Returns:
a copy of the vector of usable actions in this game

setActionUsable

public void setActionUsable(int a1,
                            int a2,
                            boolean isUsable)
Sets whether the action profile (a1,a2) is usable in equilibrium

Parameters:
a1 - player 1 action
a2 - player 2 action
isUsable - whether it is usable