poker
Class PlayerInfo

java.lang.Object
  extended by poker.PlayerInfo
All Implemented Interfaces:
java.io.Serializable

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

Stores all of the information for a player during a poker game. Also contains references to a player's past history of games. This class is a little messy from evolution, and has some ugly hooks for the AI system.

Version:
2.1.0
Author:
Aaron Davidson
See Also:
Serialized Form

Constructor Summary
PlayerInfo(java.lang.String playerName, GameInfo gi)
          Constructor.
 
Method Summary
 boolean active()
          Return true if the player is still active in the hand
 boolean allIn()
          Determine if a player is All-In
 Context getActionContext()
          Get the context of the last action made by this player.
 int getAmountCallable()
           
 int getAmountInPot()
          Obtain the amount the player has put in the pot.
 int getAmountInPotThisRound()
          Obtain the amount the player has put in the pot.this round
 int getAmountRaiseable()
           
 int getAmountToCall()
          Determine the amount a player must pay to stay in the game
 int getAmountToCall(int amount_needed)
          Determine the amount a player must pay to stay in the game
 double getBankRoll()
           
 double getBankRollInSmallBets()
           
 GameInfo getGameInfo()
          Get the context of the last action made by this player.
 int getLastAction()
          A single integer code for the last action made
 int getLastActionCode()
          A single integer code for the last action made
 int getLastAmountCalled()
          Get the amount called by this player during his last action
 double getLastBetsToCall()
          Obtain the amount of bets the player had to call during their last action.
 double getMaximumRisk()
          The maximum we can risk in the hand.
 java.lang.String getName()
          obtain the player's name
 double getNetGain()
           
 int getPosition()
          Get our position ID in the GameInfo
 Hand getRevealedHand()
          Obtain the hand revealed by this player
 boolean hasActedThisRound()
          Check if a player has made at least one action this round
 boolean hasEnoughToCall()
           
 boolean hasEnoughToRaise()
           
 boolean inGame()
           
 boolean isButton()
           
 boolean isCommitted()
          Test if a player has volunatrily committed yet in this round
 Context makeContext(int action, double bets)
          Log a context file (used to train neural nets for opponent move precition, etc...)
 void muck()
           
 double potOdds()
          Obtain the player's pot odds
 double potRatio()
          The ratio of the money in the pot that belongs to the player
 void resetBankRoll()
           
 void returnChips(int amount)
          replace the chips in the players stack
 void revealHand(Card c1, Card c2)
          Reveal the hole cards in a showdown
 void save()
           
 void setBankRoll(int br)
           
 void setBankRollAndSave(int br)
           
 void setInGame(boolean value)
           
 void startNewGame()
          Start a new game with this player
 java.lang.String toString()
           
 void win(double amount)
          Give the player some money
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlayerInfo

public PlayerInfo(java.lang.String playerName,
                  GameInfo gi)
Constructor.

Parameters:
playerName - the name of the player
gi - the game that the player is in
Method Detail

save

public void save()

getNetGain

public double getNetGain()

setBankRollAndSave

public void setBankRollAndSave(int br)

setBankRoll

public void setBankRoll(int br)

resetBankRoll

public void resetBankRoll()

getBankRoll

public double getBankRoll()

getBankRollInSmallBets

public double getBankRollInSmallBets()

inGame

public boolean inGame()

setInGame

public void setInGame(boolean value)

getPosition

public int getPosition()
Get our position ID in the GameInfo


startNewGame

public void startNewGame()
Start a new game with this player


getName

public java.lang.String getName()
obtain the player's name

Returns:
the name of this player

allIn

public boolean allIn()
Determine if a player is All-In

Returns:
true if all in, false otherwise

muck

public void muck()

win

public void win(double amount)
Give the player some money

Parameters:
amount - the amount of money to give

revealHand

public void revealHand(Card c1,
                       Card c2)
Reveal the hole cards in a showdown

Parameters:
c1 - the first card
c2 - the second card

getRevealedHand

public Hand getRevealedHand()
Obtain the hand revealed by this player

Returns:
the player's hand, or null if unrevealed

getAmountToCall

public int getAmountToCall(int amount_needed)
Determine the amount a player must pay to stay in the game

Parameters:
amount_needed - the total amount the player should have in the pot
Returns:
the amount needed to stay in.

getAmountToCall

public int getAmountToCall()
Determine the amount a player must pay to stay in the game

Returns:
the amount needed to stay in.

isCommitted

public boolean isCommitted()
Test if a player has volunatrily committed yet in this round

Returns:
true if player is committed, false if not.

hasActedThisRound

public boolean hasActedThisRound()
Check if a player has made at least one action this round

Returns:
true if player has acted in this round

potOdds

public double potOdds()
Obtain the player's pot odds

Returns:
the pot odds.

getLastAmountCalled

public int getLastAmountCalled()
Get the amount called by this player during his last action


getLastBetsToCall

public double getLastBetsToCall()
Obtain the amount of bets the player had to call during their last action.


getAmountInPot

public int getAmountInPot()
Obtain the amount the player has put in the pot.


getAmountInPotThisRound

public int getAmountInPotThisRound()
Obtain the amount the player has put in the pot.this round


makeContext

public Context makeContext(int action,
                           double bets)
Log a context file (used to train neural nets for opponent move precition, etc...)


potRatio

public double potRatio()
The ratio of the money in the pot that belongs to the player


getLastActionCode

public int getLastActionCode()
A single integer code for the last action made


getLastAction

public int getLastAction()
A single integer code for the last action made


getActionContext

public Context getActionContext()
Get the context of the last action made by this player.


getGameInfo

public GameInfo getGameInfo()
Get the context of the last action made by this player.


active

public boolean active()
Return true if the player is still active in the hand

Returns:
true if the player is still active

isButton

public boolean isButton()
Returns:
true if the player is currently the button

hasEnoughToCall

public boolean hasEnoughToCall()
Returns:
true if the player has enough money to call the current amount

hasEnoughToRaise

public boolean hasEnoughToRaise()
Returns:
true if the player has enough money to raise

getAmountRaiseable

public int getAmountRaiseable()
Returns:
the amount the player can raise

getAmountCallable

public int getAmountCallable()
Returns:
the amount the player can call

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a string representation of the PlayerInfo

getMaximumRisk

public double getMaximumRisk()
The maximum we can risk in the hand. If we have all active players covered, then we can't lose more than the biggest bankroll. Otherwise, we can lose our entire bankroll.


returnChips

public void returnChips(int amount)
replace the chips in the players stack

Parameters:
amount -