Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## glassfrog.model
Class Gamestate

    java.lang.Object
      glassfrog.model.Gamestate

All Implemented Interfaces:
  java.io.Serializable

    public class Gamestate

extends java.lang.Object
implements java.io.Serializable

The Gamestate class handles all of the state information for a particular game at any given time. This class is constantly updated and accessed. It holds information pertinant to the actual game, not the individual players such as potsize, current bet, num bets, round number

Author:
  jdavidso
See Also:
  Serialized Form

Field Summary
`private java.lang.String` | `actionString`
`private int` | `button`
`private int` | `currentBet`
`private boolean` | `handOver`
`private int` | `maxBet`
`private int` | `minBet`
`private int` | `numBets`
`private int` | `potsize`
`private int` | `round`

Constructor Summary
`Gamestate()` Default constructor.

Method Summary
`void` | `addToActionString(java.lang.String action)` Add an action to the action string.
`void` | `addToPot(int amount)` Add to the pot the amount given.
`java.lang.String` | `getActionString()` Get the the string representation of the betting sequence
`int` | `getButton()` Get the current position of the button
`int` | `getCurrentBet()` Get the current bet size
`int` | `getMaxBet()` Get the maximum bet of the game
`int` | `getMinBet()` Get the minimum bet for the game
`int` | `getNumBets()` Get the number of bets made so far in the game for the round
`int` | `getPotsize()` Get the current potsize
`int` | `getRound()` Get the current round
`boolean` | `isHandOver()` Return whether or not the hand is over
`void` | `makeBet(int betSize, int lastCommited)` Have the game commit a bet of size betSize.
`void` | `nextRound()` Increment the round by one.
`void` | `setButton(int button)` Set the position of the button
`void` | `setCurrentBet(int currentBet)` Set the current betsize
`void` | `setHandOver(boolean handOver)` Sets whether the hand is over or not
`void` | `setMaxBet(int maxBet)` Set the maximum bet of the game
`void` | `setMinBet(int minBet)` Set the minimum bet for the game
`void` | `setNumBets(int numBets)` Set the number of bets made so far in the game in this round
`void` | `setPotsize(int potsize)` Set the potsize
`void` | `setRound(int round)` Set the current round
`void` | `subtractFromPot(int amount)` Subtract from the pot the amount given.
`java.lang.String` | `toString()` A String representation of the gamestate...

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### potsize

    private int potsize

### minBet

    private int minBet

### maxBet

    private int maxBet

### currentBet

    private int currentBet

### round

    private int round

### numBets

    private int numBets

### button

    private int button

### handOver

    private boolean handOver

### actionString

    private java.lang.String actionString

Constructor Detail

### Gamestate

    public Gamestate()

  Default constructor.

Method Detail

### getButton

    public int getButton()

  Get the current position of the button

  Returns:
    an int representing position of the button

### setButton

    public void setButton(int button)

  Set the position of the button

  Parameters:
    `button` - an int representing the position of the button

### getCurrentBet

    public int getCurrentBet()

  Get the current bet size

  Returns:
    an int representing the current bet size

### setCurrentBet

    public void setCurrentBet(int currentBet)

  Set the current betsize

  Parameters:
    `currentBet` - an int representing the current betsize

### isHandOver

    public boolean isHandOver()

  Return whether or not the hand is over

  Returns:
    True if the hand is over, false otherwise

### setHandOver

    public void setHandOver(boolean handOver)

  Sets whether the hand is over or not

  Parameters:
    `handOver` - a boolean representing whether or not the hand is over

### getMaxBet

    public int getMaxBet()

  Get the maximum bet of the game

  Returns:
    an int representing the game's maximum bet

### setMaxBet

    public void setMaxBet(int maxBet)

  Set the maximum bet of the game

  Parameters:
    `maxBet` - an int representing the games max bet

### getMinBet

    public int getMinBet()

  Get the minimum bet for the game

  Returns:
    an int representing the minimum bet for the game

### setMinBet

    public void setMinBet(int minBet)

  Set the minimum bet for the game

  Parameters:
    `minBet` - an int representing the game's minimum bet

### getNumBets

    public int getNumBets()

  Get the number of bets made so far in the game for the round

  Returns:
    an int representing the number of bets made in the game for the round

### setNumBets

    public void setNumBets(int numBets)

  Set the number of bets made so far in the game in this round

  Parameters:
    `numBets` - an int representing the number of bets made in the round

### getPotsize

    public int getPotsize()

  Get the current potsize

  Returns:
    an int representing the current potsize of the game

### setPotsize

    public void setPotsize(int potsize)

  Set the potsize

  Parameters:
    `potsize` - an int representing the potsize of the game

### getRound

    public int getRound()

  Get the current round

  Returns:
    an int representing the current round of the game

### setRound

    public void setRound(int round)

  Set the current round

  Parameters:
    `round` - and int representing the current round of the game

### getActionString

    public java.lang.String getActionString()

  Get the the string representation of the betting sequence

  Returns:
    A string representing the betting sequence

### nextRound

    public void nextRound()

  Increment the round by one. Reset the current bet to 0 and the num bets; Append a "/" to the action string

### makeBet

    public void makeBet(int betSize,
                        int lastCommited)

  Have the game commit a bet of size betSize. The current bet will then be the max of the current bet and the betSize.

  Parameters:
    `betSize` - an int representing the size of the bet to make
    `lastCommited` - an int to make sure the current bet is how much the last player had in the pot

### addToPot

    public void addToPot(int amount)

  Add to the pot the amount given.

  Parameters:
    `amount` - An int amount to add to the pot

### subtractFromPot

    public void subtractFromPot(int amount)

  Subtract from the pot the amount given. Used for hand evaluation and payout

  Parameters:
    `amount` - The amount to subtract from the potsize

### addToActionString

    public void addToActionString(java.lang.String action)

  Add an action to the action string.

  Parameters:
    `action` - a string representing what actions to add to the action string

### toString

    public java.lang.String toString()

  A String representation of the gamestate... This is the human readable one for debugging, a player friendly one will have to be generated

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    A Human readable gamestate represented as a String

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD