Interface IDecisionContext
public interface IDecisionContext
The IDecisionContext interface contains methods to query the game state at
a particular decision point. It also provides helper methods to calculate
bet or raise sizings based on the current game state.
General information about player indexing
Throughout a hand, players are referenced by a constant index. Indexing starts at zero with the first player to act Preflop. The player index remains constant for the entire hand, regardless of the current street.
3-handed:- [0] BU
- [1] SB
- [2] BB
- [0] HJ
- [1] CO
- [2] BU
- [3] SB
- [4] BB
Representation of chip amounts
We strongly advice against using absolute chip amounts in scripts. All calculations should be made relative to the value of the big blind or the size of the pot. The helper methods will appropriately represent the chip amounts automatically.
Chip amounts are generally represented as 1/100th of chips. For cash games this would be equivalent of representing the amounts in cents.
e.g. If the big blind is defined as 50 chips for a hand then getSizeBigBlind() will return a value of 50 * 100 = 5,000.
-
Method Summary
Modifier and TypeMethodDescriptionSequence of actions for the current street.getActionSequence
(int street) Sequence of actions for the selected street.Full sequence of actions for the entire hand.int
Index of the current player.int
Number of bets or raises on the current street.int
Number of flat calls against the most recent bet or raise on the current street.The most recent bet or raise during this hand.int
Number of players on the current table.int
Index of the big blind player.int
Index of the button player.int
Index of the small blind player.State of the pot at the current decision point.long
Size of the nominal ante per player.long
Size of the nominal big blind.long
Size of the nominal small blind.double
Stack to pot ratio for the current effective stacks.int
The current street.boolean
Tests whether a bet by the current player would be a donk bet.boolean
isPlayerInBlinds
(int player) Tests whether the specified player is in the blinds.boolean
isPlayerInPosition
(int playerA, int playerB) Tests whether a player has Postflop position against another player.long
Sizing for an all-in bet or raise.long
sizingBigBlinds
(double sizeInBigBlinds) Calculate a bet/raise-to sizing in big blinds.long
sizingGeometric
(int numberBets) Calculate sizing to get smoothly all-in for effective stacks with the number of bets or raises.long
sizingGeometricHint
(double hint) Calculate the geometric sizing that is closest to the specified hint.long
Minimum legal size for a bet or raise.long
sizingPot
(double fraction) Calculate a bet/raise sizing as a fraction of the pot.long[]
sizingsPreflop
(String sizing) Calculate preflop sizings, compatible with UI sizing syntax.
-
Method Details
-
getSizeBigBlind
long getSizeBigBlind()Size of the nominal big blind. This returns the full value of the big blind, even if the player couldn't post the full amount.- Returns:
- size of the big blind as 1/100th of chips
-
getSizeSmallBlind
long getSizeSmallBlind()Size of the nominal small blind. This returns the full value of the small blind, even if the player couldn't post the full amount.- Returns:
- size of the small blind as 1/100th of chips
-
getSizeAnte
long getSizeAnte()Size of the nominal ante per player. This returns the full value of the antes, even if one or more players couldn't post the full amount.- Returns:
- size of the ante as 1/100th of chips
-
getStreet
int getStreet()The current street. Preflop (0), Flop(1), Turn(2), River(3)- Returns:
- current street
-
getFlatCallCount
int getFlatCallCount()Number of flat calls against the most recent bet or raise on the current street. Returns zero if there were no bets or raises on the current street.- Returns:
- number of flat calls
-
getBetCount
int getBetCount()Number of bets or raises on the current street. The blinds count as the first bet Preflop.- Returns:
- number of bets
-
getNumberOfPlayers
int getNumberOfPlayers()Number of players on the current table.- Returns:
- number of players
-
getActivePlayer
int getActivePlayer()Index of the current player. Indexing starts with zero at the player first to act Preflop.- Returns:
- active player index
-
getPlayerIndexSmallBlind
int getPlayerIndexSmallBlind()Index of the small blind player.- Returns:
- index of SB position
-
getPlayerIndexBigBlind
int getPlayerIndexBigBlind()Index of the big blind player.- Returns:
- index of BB position
-
getPlayerIndexButton
int getPlayerIndexButton()Index of the button player.- Returns:
- index of BU position
-
getLastRaiseAction
IPlayerAction getLastRaiseAction()The most recent bet or raise during this hand.- Returns:
- IPlayerAction for the last bet or raise, null if there was no previousd bet / raise
-
isPlayerInBlinds
boolean isPlayerInBlinds(int player) Tests whether the specified player is in the blinds.- Parameters:
player
- the index of the selected player.- Returns:
- True iff the selected player is in the small blind or big blind.
-
isPlayerInPosition
boolean isPlayerInPosition(int playerA, int playerB) Tests whether a player has Postflop position against another player.- Parameters:
playerA
- index of first playerplayerB
- index of second player- Returns:
- true if playerA has position against playerB
-
sizingBigBlinds
long sizingBigBlinds(double sizeInBigBlinds) Calculate a bet/raise-to sizing in big blinds.- Parameters:
sizeInBigBlinds
- number of big blinds to bet or raise to- Returns:
- Sizing in 1/100th of chips
-
sizingMinimum
long sizingMinimum()Minimum legal size for a bet or raise.- Returns:
- Sizing in 1/100th of chips
-
sizingAllIn
long sizingAllIn()Sizing for an all-in bet or raise. This returns the effective all-in size for the current stacks.- Returns:
- Sizing in 1/100th of chips
-
sizingPot
long sizingPot(double fraction) Calculate a bet/raise sizing as a fraction of the pot.
- sizingPot(0.5) for a half-pot sized bet/raise
- sizingPot(1.0) for a pot sized bet/raise
- etc.
- Parameters:
fraction
- fraction of the pot to bet or raise- Returns:
- Sizing in 1/100th of chips
-
sizingGeometric
long sizingGeometric(int numberBets) Calculate sizing to get smoothly all-in for effective stacks with the number of bets or raises. In multiway pots this assumes only two players will continue after the next bet or raise.- Parameters:
numberBets
- number of bets / raises- Returns:
- Sizing in 1/100th of chips
-
sizingGeometricHint
long sizingGeometricHint(double hint) Calculate the geometric sizing that is closest to the specified hint.- Parameters:
hint
- preferred size as fraction of the pot- Returns:
- Sizing in chips * 100
-
sizingsPreflop
Calculate preflop sizings, compatible with UI sizing syntax.
Supported syntax for Preflop sizings:- "2.5bb" raise to 2.5bb. The "bb" part is optional.
- "3.0x" raise to 3 times the previous raise amount
- "100%" raise by 100% of the pot
- "all-in" / "ai" raise for effective stacks
Specifying squeeze and iso sizings:- "2.5bb + 1bb" raise to 2.5bb, add 1bb per limper
- "2.5bb + 1bb + 0.5bb" raise to 2.5bb, add 1bb for the first limper and 0.5bb for each additional one
- "3x + 1x" raise to 3x the previous raise amount, increase by 1x for each caller
Multiple sizings can be separated by comma, e.g. "2.0bb, 3.0bb".- Parameters:
sizing
- one or more sizings using the UI syntax- Returns:
- An array of sizings in chips * 100
-
getStackPotRatio
double getStackPotRatio()Stack to pot ratio for the current effective stacks. If there is an uncalled bet or raise, the calling amount for the current player is added to the pot before calculating the ratio.- Returns:
- (effective remaining stacks) / (pot after calling)
-
isDonkBet
boolean isDonkBet()Tests whether a bet by the current player would be a donk bet. Returns true for bets made when the last aggressor of the previous street is yet to act on the current street. In the case that the last aggressor of the previous street is all-in this returns false.- Returns:
- true if betting would be a donk bet
-
getActionSequenceFull
IPlayerAction[] getActionSequenceFull()Full sequence of actions for the entire hand.- Returns:
- array of actions
-
getActionSequence
IPlayerAction[] getActionSequence()Sequence of actions for the current street.- Returns:
- array of actions
-
getActionSequence
Sequence of actions for the selected street.- Parameters:
street
- Selected street, -1 can be used for the current street.- Returns:
- array of actions
-
getPotState
IPotState getPotState()State of the pot at the current decision point.- Returns:
- state of the pot
-