glassfrog.model
Class Gamedef

java.lang.Object
  extended by glassfrog.model.Gamedef
All Implemented Interfaces:
java.io.Serializable

public class Gamedef
extends java.lang.Object
implements java.io.Serializable

A class used to define all of the properties of the game. The properties can either be specified through getters and setters, a constructor or parsed in via an XML file

Author:
jdavidso
See Also:
Serialized Form

Field Summary
private  int[] betsPerRound
           
private  int[] betStructure
           
private  int[] blindStructure
           
private  boolean doylesGame
           
private  int maxBet
           
private  int maxPlayers
           
private  int minBet
           
private  int minPlayers
           
private  boolean noLimit
           
private  int[] numPrivateCards
           
private  int[] numPublicCards
           
private  int numRounds
           
private  boolean reverseBlinds
           
private static long serialVersionUID
           
private  int smallBlind
           
private  int stackSize
           
 
Constructor Summary
Gamedef()
          Default contructor.
Gamedef(java.lang.String path)
          A contructor for a gamedef that takes a path to an XML file that represents that gamedef
 
Method Summary
 int getBet(int index)
          Get the raise value associated with the round.
 int[] getBetsPerRound()
          Return an array representing the number of bets allowed in a round.
 int[] getBetStructure()
          Get the betting structure for the game.
 int getBlind(int index)
          Get the blind / ante associated with the index using the blind structure and the small blind value.
 int[] getBlindStructure()
          The Blind structure is an array that represents what players must pay an ante or blind.
 int getMaxBet()
          Return the maximum bet size of the game.
 int getMaxPlayers()
          Get the maximum amount of players alloed to play in this game
 int getMinBet()
          Get the minimum bet for the game
 int getMinPlayers()
          Get the minimum amount of players allowed to play in this game
 int[] getNumPrivateCards()
          Get the number of private cards each player is dealt.
 int[] getNumPublicCards()
          Get the number of puyblic cards dealt each round.
 int getNumRounds()
          Get the number of rounds to be played each hand.
 int getSmallBlind()
          Get the size of the small blind.
 int getStackSize()
          Get the starting stack size assiged to the players if using set stack sizes as in Doyles Game
 boolean isDoylesGame()
          Check to see whether or not this game is Doyles Game, a game where we reset the stack size after every hand and keep a score instead of overall stack achievement
 boolean isNoLimit()
          Check to see if this is a no limit betting game
 boolean isReverseBlinds()
          Check to see whether or not reverse blinds is in effect.
private  java.lang.String printArray(int[] array)
          A helper function to print an int array to a string, comma delimited
 void setBetsPerRound(int[] betsPerRound)
          Set the number of bets allowed per round.
 void setBetStructure(int[] betStructure)
          Set the betting structure for the game.
 void setBlindStructure(int[] blindStructure)
          Set up the blind structure.
 void setDoylesGame(boolean doylesGame)
          Set whether or not this game is Doyles Game, a game where we reset the stack size after every hand and keep a score instead of overall stack achievement
 void setMaxBet(int maxBet)
          Set the max bet a player is allowed to make in the game.
 void setMaxPlayers(int maxPlayers)
          Set the maximum amount of players allowed in the game
 void setMinBet(int minBet)
          Set the minimum bet for the game
 void setMinPlayers(int minPlayers)
          Set the minimum amount of players allowed in the game
 void setNoLimit(boolean noLimit)
          Set whether or not this is a no limit betting game
 void setNumPrivateCards(int[] numPrivateCards)
          Set the number of private cards each player is dealt.
 void setNumPublicCards(int[] numPublicCards)
          Set the number of puyblic cards dealt each round.
 void setNumRounds(int numRounds)
          Set the number of rounds to be played each hand.
 void setReverseBlinds(boolean reverseBlinds)
          Set whether or not reverse blinds is in effect.
 void setSmallBlind(int smallBlind)
          Set the size of the small blind.
 void setStackSize(int stackSize)
          Set the starting stack size value for each player if using set stack sizes as in Doyles Game
 java.lang.String toString()
          Get the gamedef as a String;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

numRounds

private int numRounds

maxPlayers

private int maxPlayers

minPlayers

private int minPlayers

minBet

private int minBet

maxBet

private int maxBet

stackSize

private int stackSize

smallBlind

private int smallBlind

blindStructure

private int[] blindStructure

numPrivateCards

private int[] numPrivateCards

numPublicCards

private int[] numPublicCards

betsPerRound

private int[] betsPerRound

betStructure

private int[] betStructure

reverseBlinds

private boolean reverseBlinds

doylesGame

private boolean doylesGame

noLimit

private boolean noLimit
Constructor Detail

Gamedef

public Gamedef()
Default contructor. Set to 2 player texas holdem limit 1/2 for testing


Gamedef

public Gamedef(java.lang.String path)
        throws javax.xml.parsers.ParserConfigurationException,
               org.xml.sax.SAXParseException,
               org.xml.sax.SAXException,
               java.io.IOException
A contructor for a gamedef that takes a path to an XML file that represents that gamedef

Parameters:
path - The path to the gamedef XML file
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXParseException
org.xml.sax.SAXException
java.io.IOException
Method Detail

getBlindStructure

public int[] getBlindStructure()
The Blind structure is an array that represents what players must pay an ante or blind. The numbers are in terms of small blinds, so for Texas Holdem, with a big and small blind the array looks like [1,2]. For an ante game with 4 players, each paying an ante every round, it looks like [1,1,1,1].

Returns:
an array representing the blind or antes

setBlindStructure

public void setBlindStructure(int[] blindStructure)
Set up the blind structure. The indices of the array corrispond to the player starting with the first player left of the dealer and the values corrispond to the size of blind in multiples of the small blind

Parameters:
blindStructure - an array representing the blinds or antes

getBetsPerRound

public int[] getBetsPerRound()
Return an array representing the number of bets allowed in a round. The array indices corrispond to the round and the values to the number of bets allowed

Returns:
an array representing the bets per round

setBetsPerRound

public void setBetsPerRound(int[] betsPerRound)
Set the number of bets allowed per round. The array indices corrispond to the round and the values to the number of bets allowed

Parameters:
betsPerRound - an array representing the bets per round

getBetStructure

public int[] getBetStructure()
Get the betting structure for the game. This is for games where bet sizes are fixed per round, and we need to knwo what that system is. For limit Texas Holdem where we have a small and big bet, adn the big bet is on the turn and river, the array will look like [1,1,2,2] where these are multiples of the betsize.

Returns:
an array representing the bet structure of the game

setBetStructure

public void setBetStructure(int[] betStructure)
Set the betting structure for the game. This is for games where bet sizes are fixed per round, and we need to knwo what that system is. For limit Texas Holdem where we have a small and big bet, adn the big bet is on the turn and river, the array will look like [1,1,2,2] where these are multiples of the betsize.

Parameters:
betStructure - an array representing the bet structure of the game

getMaxBet

public int getMaxBet()
Return the maximum bet size of the game.

Returns:
an int representation of the max bet size

setMaxBet

public void setMaxBet(int maxBet)
Set the max bet a player is allowed to make in the game.

Parameters:
maxBet - an int representing the max bet a player is allowed to make

getMaxPlayers

public int getMaxPlayers()
Get the maximum amount of players alloed to play in this game

Returns:
an int representing the the maximum amount of players

setMaxPlayers

public void setMaxPlayers(int maxPlayers)
Set the maximum amount of players allowed in the game

Parameters:
maxPlayers - an int representing the the maximum amount of players

getMinPlayers

public int getMinPlayers()
Get the minimum amount of players allowed to play in this game

Returns:
an int representing the the minimum amount of players

setMinPlayers

public void setMinPlayers(int minPlayers)
Set the minimum amount of players allowed in the game

Parameters:
minPlayers - an int representing the the minimum amount of players

isDoylesGame

public boolean isDoylesGame()
Check to see whether or not this game is Doyles Game, a game where we reset the stack size after every hand and keep a score instead of overall stack achievement

Returns:
True for Doyles Game, False otherwise

setDoylesGame

public void setDoylesGame(boolean doylesGame)
Set whether or not this game is Doyles Game, a game where we reset the stack size after every hand and keep a score instead of overall stack achievement

Parameters:
doylesGame - True for Doyles Game, False otherwise

getMinBet

public int getMinBet()
Get the minimum bet for the game

Returns:
an int representing the minimum bet size for the game

setMinBet

public void setMinBet(int minBet)
Set the minimum bet for the game

Parameters:
minBet - an int representing the minimum bet size for the game

isNoLimit

public boolean isNoLimit()
Check to see if this is a no limit betting game

Returns:
True for no limit games, false otherwise

setNoLimit

public void setNoLimit(boolean noLimit)
Set whether or not this is a no limit betting game

Parameters:
noLimit - True for no limit, false otherwise

getNumPrivateCards

public int[] getNumPrivateCards()
Get the number of private cards each player is dealt. The indices corrispond to the round and the values corrispond to how many cards a player is dealt in that round. Texas Holdem looks like [2,0,0,0].

Returns:
an array of ints representing the cards dealt to the players.

setNumPrivateCards

public void setNumPrivateCards(int[] numPrivateCards)
Set the number of private cards each player is dealt. The indices corrispond to the round and the values corrispond to how many cards a player is dealt in that round. Texas Holdem looks like [2,0,0,0].

Parameters:
numPrivateCards - an array of ints representing the cards dealt to the players.

getNumPublicCards

public int[] getNumPublicCards()
Get the number of puyblic cards dealt each round. The indices corrispond to the round and the values corrispond to how many cards are dealt in that round. Texas Holdem looks like [0,3,1,1].

Returns:
an array of ints representing the cards dealt each round.

setNumPublicCards

public void setNumPublicCards(int[] numPublicCards)
Set the number of puyblic cards dealt each round. The indices corrispond to the round and the values corrispond to how many cards are dealt in that round. Texas Holdem looks like [0,3,1,1].

Parameters:
numPublicCards - an array of ints representing the cards dealt each round.

getNumRounds

public int getNumRounds()
Get the number of rounds to be played each hand. This should corrispond to the size of the card arrays and betting arrays if being used

Returns:
an int representing the number of rounds to be played each hand

setNumRounds

public void setNumRounds(int numRounds)
Set the number of rounds to be played each hand. This should corrispond to the size of the card arrays and betting arrays if being used

Parameters:
numRounds - an int representing the number of rounds to be played each hand

isReverseBlinds

public boolean isReverseBlinds()
Check to see whether or not reverse blinds is in effect. This is a two player Texas Holdem trait where the blinds are reversed in heads up play to retain dealer positional avantage.

Returns:
True if reverse blinds are in play, false otherwise

setReverseBlinds

public void setReverseBlinds(boolean reverseBlinds)
Set whether or not reverse blinds is in effect. This is a two player Texas Holdem trait where the blinds are reversed in heads up play to retain dealer positional avantage.

Parameters:
reverseBlinds - a boolean used to set the reverseBlinds flag

getSmallBlind

public int getSmallBlind()
Get the size of the small blind.

Returns:
an int representing the value of the small blind

setSmallBlind

public void setSmallBlind(int smallBlind)
Set the size of the small blind.

Parameters:
smallBlind - an int representing the value of the small blind

getStackSize

public int getStackSize()
Get the starting stack size assiged to the players if using set stack sizes as in Doyles Game

Returns:
an int representing the starting stack size for the players

setStackSize

public void setStackSize(int stackSize)
Set the starting stack size value for each player if using set stack sizes as in Doyles Game

Parameters:
stackSize - an int representing the starting stack size for the players

getBlind

public int getBlind(int index)
Get the blind / ante associated with the index using the blind structure and the small blind value.

Parameters:
index - The index from which to return the blind value
Returns:
the value of the blind for the given index

getBet

public int getBet(int index)
Get the raise value associated with the round. This is used for games where there are different betsizes for different rounds given in terms of minBets

Parameters:
index - The index from which to return the bet value
Returns:
the value of the bet for the given index

toString

public java.lang.String toString()
Get the gamedef as a String;

Overrides:
toString in class java.lang.Object
Returns:
a String representing relative gamedef info

printArray

private java.lang.String printArray(int[] array)
A helper function to print an int array to a string, comma delimited

Parameters:
array - an int array
Returns:
A string representation of the array in the form {1,2,3,....}