meerkat

poker
Class GameRecord

java.lang.Object
  extended by poker.GameRecord

public class GameRecord
extends java.lang.Object

Logs a GameInfo object to disk as our standard formatted game log string.

Author:
davidson

Constructor Summary
GameRecord(GameInfo gi)
           
GameRecord(java.lang.String gameRecString)
          Creates a new GameRecord out of a game record log string.
 
Method Summary
 java.lang.String boardString()
           
 java.lang.String cardString(java.lang.String str)
           
 java.lang.String generateTranscript()
          Given a GameRecord, generate a text transcript of the hand
 int getAction(int pi, int n)
           
 Hand getBoard()
          Returns the board.
 int getButton()
          Returns the position of the button.
 Hand[] getCards()
          Returns each player's hole cards.
 int getID()
          Returns the id of the game.
 java.lang.String[] getNames()
          Returns each player's name.
 int getNumActionType(int pos, char act, int stageFilter)
          Get the number of an action made by this player
 int getNumPlayers()
          Returns the number of players.
 int getNumWinners()
           
 int getPlayedStage(int pos)
          Get the stage of the game this player went to.
 int getPlayerIndex(java.lang.String name)
           
 int getPlayerPosition(java.lang.String name)
          Find the position of the given player by name
 java.lang.String getSequence()
          Returns the betting sequence.
 double getValue(int pos)
           
 double[] getValues()
          Returns each player's value.
 java.lang.String toString()
           
 java.lang.String toStringFull()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GameRecord

public GameRecord(GameInfo gi)

GameRecord

public GameRecord(java.lang.String gameRecString)
Creates a new GameRecord out of a game record log string.

Method Detail

toStringFull

public java.lang.String toStringFull()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

cardString

public java.lang.String cardString(java.lang.String str)

boardString

public java.lang.String boardString()

getPlayerIndex

public int getPlayerIndex(java.lang.String name)

getAction

public int getAction(int pi,
                     int n)

getID

public int getID()
Returns the id of the game.


getNumPlayers

public int getNumPlayers()
Returns the number of players.


getButton

public int getButton()
Returns the position of the button.


getBoard

public Hand getBoard()
Returns the board.


getSequence

public java.lang.String getSequence()
Returns the betting sequence.


getNames

public java.lang.String[] getNames()
Returns each player's name.


getPlayerPosition

public int getPlayerPosition(java.lang.String name)
Find the position of the given player by name

Parameters:
name - the name of the player
Returns:
the position of the player, or -1 if not found

getCards

public Hand[] getCards()
Returns each player's hole cards.


getValues

public double[] getValues()
Returns each player's value.


getValue

public double getValue(int pos)

getNumWinners

public int getNumWinners()

getPlayedStage

public int getPlayedStage(int pos)
Get the stage of the game this player went to.

Parameters:
pos - the position of the player
Returns:
the stage they played until

getNumActionType

public int getNumActionType(int pos,
                            char act,
                            int stageFilter)
Get the number of an action made by this player

Parameters:
pos - the position of the player
act - the action character to count
stage - count only for this stage (-1 is all stages)
Returns:
a table containing sum of each type of action

generateTranscript

public java.lang.String generateTranscript()
Given a GameRecord, generate a text transcript of the hand


meerkat