Skip to content

Releases: uoftcprg/pokerkit

v0.6.0-alpha.0

17 Dec 23:45
Compare
Choose a tag to compare

This version release introduces backward incompatible changes. Please read the below content carefully!

Added

  • Parsing hands from logs of online poker rooms/research environments. The testing has been limited to old data and is known to fail to parse certain hands. Please open an issue if you find incompatibilities. I would be happy to support them.

    • Absolute Poker: pokerkit.notation.HandHistory.from_absolute_poker() via pokerkit.notation.AbsolutePokerParser.
    • Full Tilt Poker: pokerkit.notation.HandHistory.from_full_tilt_poker() via pokerkit.notation.FullTiltPokerParser.
    • iPoker Network: pokerkit.notation.HandHistory.from_ipoker_network() via pokerkit.notation.IPokerNetworkParser.
    • Ongame Network: pokerkit.notation.HandHistory.from_ongame_network() via pokerkit.notation.OngameNetworkParser.
    • PartyPoker: pokerkit.notation.HandHistory.from_partypoker() via pokerkit.notation.PartyPokerParser.
    • PokerStars: pokerkit.notation.HandHistory.from_pokerstars() via pokerkit.notation.PokerStarsParser.
    • Annual Computer Poker Competition: pokerkit.notation.HandHistory.from_acpc_protocol() via pokerkit.notation.ACPCProtocolParser.
  • Base classes for hand history log parser using regular expressions like pokerkit.notation.Parser and pokerkit.notation.REParser.

  • pokerkit.utilities.Card.UNKNOWN static variable as a constant for a card with unknown rank and suit.

  • Pending additions of the PHH specification are also added in pokerkit.notation.HandHistory. Namely, the new fields pokerkit.notation.HandHistory.venue, pokerkit.notation.HandHistory.time_zone_abbreviation, pokerkit.notation.HandHistory.winnings, and pokerkit.notation.HandHistory.currency_symbol.

  • A helper unmatchable regular expression pattern pokerkit.utilities.UNMATCHABLE_PATTERN.

  • Helper methods pokerkit.utilities.rotated, pokerkit.utilities.parse_time, and pokerkit.utilities.parse_month.

Changed

  • pokerkit.state.ChipsPushing's board_index and hand_index attributes will be None when the hands terminate due to every player except one folding. Previously, -1 was used to denote as such.

  • Automatic repair of broken hand histories during iteration.

  • Allow non-standard folds (i.e. folding even when you don't need to) in a cash-game mode.

  • Allow showing the hole cards of the last remaining player after everyone folds around.

  • Allow only showing a part of a player's hand.

    • Only available in the cash-game mode.

    • A player may want to keep cards face-down (even in all-in situations or final showdown).

    • Simply pass in something like ??As or an empty iterable to pokerkit.state.State.show_or_muck_hole_cards().

      • If an empty iterable is passed in or all passed cards are unknown (i.e. ??), all hole cards of the current showdown player will stay face down.
      • If known cards are among the passed cards, the known cards will become face-up while all others will stay face-down.
  • pokerkit.utilities.Card instances are truthy or falsy depending on the Boolean value of pokerkit.utilities.Card.unknown_status.

  • Pending additions of the PHH specification is also added in pokerkit.notation.HandHistory. Namely, the widening of types for pokerkit.notation.HandHistory.hand and pokerkit.notation.HandHistory.table.

  • Commas are handled pokerkit.utilities.Card.parse and pokerkit.utilities.parse_value.

  • "10" is now a valid way to express the rank of 10 for cards in pokerkit.utilities.Card.parse.

  • pokerkit.utilities.parse_value returns decimal.Decimal for decimal values instead of float, as it used to. If integral, it returns int as it used to.

  • Cleaned up docstrings or fixed docstring inaccuracies.

  • Fix inaccurate error messages.

  • Fix error raised during equity calculation when no valid hand can be formed.

Removed

  • The previously deprecated pokerkit.notation.HandHistory.iter_state_actions(). This was deprecated and renamed to pokerkit.notation.HandHistory.state_actions in Version 0.5.4.

v0.5.4

08 Sep 01:42
Compare
Choose a tag to compare

Added

  • Post bet support.

    • Post bets are a type of forced bet which a player who just seated must pay to play right away instead of waiting for the button to pass.

    • To denote a post bet, it must be passed alongside raw_blinds_or_straddles variable during state construction.

      • For example, say UTG+1 wants to put a post-bet in a 6-max game. Then, [1, 2, 0, -2, 0, 0] or, equivalently, {0: 1, 1: 2, 3: -2}.
  • pokerkit.notation.HandHistory.state_actions is a new alias for pokerkit.notation.HandHistory.iter_state_actions().

Deprecated

  • pokerkit.notation.HandHistory.iter_state_actions() due to poor naming. It is superceded by pokerkit.notation.HandHistory.state_actions which behaves identically. This method will be removed in PokerKit Version 0.6.

v0.5.3

01 Sep 20:49
Compare
Choose a tag to compare

Changed

  • Fix incorrect implementation of pokerkit.hands.StandardBadugi.from_game.

v0.5.2

14 Jun 09:19
Compare
Choose a tag to compare

Changed

  • Allow numbers.Number like decimal.Decimal to be used as chip values. While documented as allowed, usage of non-int or non-float used to result in error.
  • The main pot is pushed first, followed by side pots (reverse was true previously).
  • Chips pushing operation is more fine-grained in that each operation pushes a portion of the main/side pot should there be multiple boards or hand types.
  • Removed pokerkit.state.ChipsPushing.raked_amount attribute.
  • Removed pokerkit.state.ChipsPushing.unraked_amount property.

Added

  • Added pokerkit.state.ChipsPushing.pot_index, pokerkit.state.ChipsPushing.board_index, and pokerkit.state.ChipsPushing.hand_type_index attributes to provide information on what portion of the pot was pushed.
  • Added ICM calculation pokerkit.analysis.calculate_icm function.

v0.5.1

27 May 07:32
Compare
Choose a tag to compare

Added

  • Add standard error property pokerkit.analysis.Statistics.payoff_stderr to statistics.

v0.5.0

26 Apr 03:35
Compare
Choose a tag to compare

This version release introduces a number of backward incompatible changes. Please read the below content carefully!

Summary of changes

  • Minor cleanup that may break older code.

  • Option to choose cash-game vs. tournament (default) mode (defaults to tournament mode).

    • Unlike in tourneys, in cash-games, players can select the number of runouts during all-in situations or opt to not show their hand after an all-in.
  • Option to choose the number of runouts during all-in situations (disabled in tournament mode).

    • In theory, people choose number of runouts before they show their hands. But, this isn't always followed. It is also unclear who must select the number of runouts first. As such, after all-in, when showdown takes place,
  • Multi-board games.

  • More degree of freedom in hole dealing/showdown order.

  • Docstring and documentation overhaul.

  • Unknown starting stacks can be expressed with math.inf.

  • More flexible raking system.

Changed

  • The parameters divmod, and rake for relevant poker game/state initialization methods are now keyword-only arguments. Before, one could supply them as positional arguments but this is no longer allowed!

  • pokerkit.state.State.board_cards (previously list[Card]) is now of type list[list[Card]].

    • For example, if an all-in happens on the flop (AsKsQs) and is run twice (JsTs, JhTh), state.board_cards == [[As], [Ks], [Qs], [Js, Jh], [Ts, Th]]. Or, when double board omaha is played, something like state.board_cards == [[??, ??], [??, ??], [??, ??]] will develop after the flop.
    • The function signatures for pokerkit.state.State.get_hand, pokerkit.state.State.get_up_hand, and pokerkit.state.State.get_up_hands now also requires the board_index to be supplied.
    • The properties/method pokerkit.state.State.reserved_cards, pokerkit.state.State.cards_in_play, pokerkit.state.State.cards_not_in_play, and pokerkit.state.State.get_dealable_cards(deal_count: int) now return Iterator[Card] instead of tuple[Card, ...].
    • The method triplets for the hole dealing and showdown operation pokerkit.state.State.verify_hole_dealing(), pokerkit.state.State.can_deal_hole(), pokerkit.state.State.deal_hole(), pokerkit.state.State.verify_hole_cards_showing_or_mucking(), pokerkit.state.State.can_show_or_muck_hole_cards(), and pokerkit.state.State.show_or_muck_hole_cards() also accepts an optional positional argument player_index to control the dealee, or the showdown performer. The verifiers also returns a player dealt if the dealee is not specified.
  • The card-burning-related methods pokerkit.state.State.verify_card_burning, pokerkit.state.State.can_burn_card, and pokerkit.state.State.burn_card also accept a singleton card iterable.

  • The pokerkit.state.State.all_in_show_status was renamed to pokerkit.state.State.all_in_status.

  • Renamed pokerkit.state.ChipsPushing.rake to pokerkit.state.ChipsPushing.raked_amount.

  • The attribute pokerkit.state.Pot.amount is now a property and no longer a parameter during initialization.

Added

  • New enum class pokerkit.state.State.Mode for setting tournament/cash-game mode while initializing poker states.

    • Tournament mode: pokerkit.state.Mode.TOURNAMENT

    • Cash-game mode: pokerkit.state.Mode.CASH_GAME

      • In all-in situations, players have a chance to choose the number of runouts during showdown.
  • New parameter mode in relevant poker game/state initialization methods. It defaults to tournament mode.

  • New parameter starting_board_count in relevant poker game/state initialization methods. It defaults to 1. This allow multiple boards to be dealt if wished.

  • New automation pokerkit.state.State.Automation.RUNOUT_COUNT_SELECTION which instructs PokerKit to carry out only one run-out.

  • New pokerkit.state.RunoutCountSelection operation.

    • Arguments: runout_count and player_index who gives out the selection.
    • Querier: pokerkit.state.State.can_select_runout_count(player_index: int | None = None, runout_count: int | None = None).
    • Validator: pokerkit.state.State.verify_runout_count_selection(player_index: int | None = None, runout_count: int | None = None).
    • Operator: pokerkit.state.State.select_runout_count(player_index: int | None = None, runout_count: int | None = None, *, commentary: str | None = None).
    • People who can select run count: pokerkit.state.State.runout_count_selector_indices.
    • If runout_count are in disagreement among active players, only 1 runout is performed.
    • When multiple runs are selected, the state will be incompatible with the PHH file format, as it stands.
  • New attributes pokerkit.state.State.street_return_index and pokerkit.state.State.street_return_count that internally keeps track what street to return to and how many times to do so during multiple runouts.

  • New attribute pokerkit.state.State.runout_count that shows the players' preferences on the number of runouts. It maybe None in which case the runout selection was skipped due to the state being of tournament mode or all players showed no preference by passing in None (or leaving empty) for the runout_count argument during the corresponding method call of pokerkit.state.select_runout_count().

  • New attributes pokerkit.state.State.board_count and pokerkit.state.State.board_indices on the number of boards and the range of its indices. The number of boards is at least 1 but may be more due to multiple runouts or the variant being played.

  • New method pokerkit.state.State.get_board_cards(board_index: int) on getting the board_index'th board.

    • The maximum number of boards is either equal to the number of boards of the variant or (in case of multiple runouts) the product of it and the number of runouts.
  • New attribute pokerkit.state.State.runout_count_selector_statuses that keeps track of who can select the number of runouts.

  • New attribute pokerkit.state.State.runout_count_selection_flag that keeps track of whether the runout count selection has been carried out.

  • In pokerkit.utilities.rake, added parameters state, cap, and no_flop_no_drop, and rake is now renamed as percentage and is a keyword parameter.

  • New attributes pokerkit.state.Pot.raked_amount and pokerkit.state.Pot.unraked_amount that gives the raked and the unraked amounts of the pot.

  • New property pokerkit.state.ChipsPushing.unraked_amount.

  • New attribute pokerkit.state.payoffs for keeping track of payoffs (rewards).

v0.5.0-alpha.1

24 Apr 16:37
Compare
Choose a tag to compare

This version release introduces a number of backward incompatible changes. Please read the below content carefully!

Summary of changes

  • Minor cleanup that may break older code.

  • Option to choose cash-game vs. tournament (default) mode (defaults to tournament mode).

    • Unlike in tourneys, in cash-games, players can select the number of runouts during all-in situations or opt to not show their hand after an all-in.
  • Option to choose the number of runouts during all-in situations (disabled in tournament mode).

    • In theory, people choose number of runouts before they show their hands. But, this isn't always followed. It is also unclear who must select the number of runouts first. As such, after all-in, when showdown takes place,
  • Multi-board games.

  • More degree of freedom in hole dealing/showdown order.

  • Docstring and documentation overhaul.

Changed

  • The parameters divmod, and rake for relevant poker game/state initialization methods are now keyword-only arguments. Before, one could supply them as positional arguments but this is no longer allowed!

  • pokerkit.state.State.board_cards (previously list[Card]) is now of type list[list[Card]].

    • For example, if an all-in happens on the flop (AsKsQs) and is run twice (JsTs, JhTh), state.board_cards == [[As], [Ks], [Qs], [Js, Jh], [Ts, Th]]. Or, when double board omaha is played, something like state.board_cards == [[??, ??], [??, ??], [??, ??]] will develop after the flop.
    • The function signatures for pokerkit.state.State.get_hand, pokerkit.state.State.get_up_hand, and pokerkit.state.State.get_up_hands now also requires the board_index to be supplied.
    • The properties/method pokerkit.state.State.reserved_cards, pokerkit.state.State.cards_in_play, pokerkit.state.State.cards_not_in_play, and pokerkit.state.State.get_dealable_cards(deal_count: int) now return Iterator[Card] instead of tuple[Card, ...].
    • The method triplets for the hole dealing and showdown operation pokerkit.state.State.verify_hole_dealing(), pokerkit.state.State.can_deal_hole(), pokerkit.state.State.deal_hole(), pokerkit.state.State.verify_hole_cards_showing_or_mucking(), pokerkit.state.State.can_show_or_muck_hole_cards(), and pokerkit.state.State.show_or_muck_hole_cards() also accepts an optional positional argument player_index to control the dealee, or the showdown performer. The verifiers also returns a player dealt if the dealee is not specified.
  • The card-burning-related methods pokerkit.state.State.verify_card_burning, pokerkit.state.State.can_burn_card, and pokerkit.state.State.burn_card also accept a singleton card iterable.

  • The pokerkit.state.State.all_in_show_status was renamed to pokerkit.state.State.all_in_status.

  • Renamed pokerkit.state.ChipsPushing.rake to pokerkit.state.ChipsPushing.raked_amount.

  • The attribute pokerkit.state.Pot.amount is now a property and no longer a parameter during initialization.

Added

  • New enum class pokerkit.state.State.Mode for setting tournament/cash-game mode while initializing poker states.

    • Tournament mode: pokerkit.state.Mode.TOURNAMENT

    • Cash-game mode: pokerkit.state.Mode.CASH_GAME

      • In all-in situations, players have a chance to choose the number of runouts during showdown.
  • New parameter mode in relevant poker game/state initialization methods. It defaults to tournament mode.

  • New parameter starting_board_count in relevant poker game/state initialization methods. It defaults to 1. This allow multiple boards to be dealt if wished.

  • New automation pokerkit.state.State.Automation.RUNOUT_COUNT_SELECTION which instructs PokerKit to carry out only one run-out.

  • New pokerkit.state.RunoutCountSelection operation.

    • Arguments: runout_count and player_index who gives out the selection.
    • Querier: pokerkit.state.State.can_select_runout_count(player_index: int | None = None, runout_count: int | None = None).
    • Validator: pokerkit.state.State.verify_runout_count_selection(player_index: int | None = None, runout_count: int | None = None).
    • Operator: pokerkit.state.State.select_runout_count(player_index: int | None = None, runout_count: int | None = None, *, commentary: str | None = None).
    • People who can select run count: pokerkit.state.State.runout_count_selector_indices.
    • If runout_count are in disagreement among active players, only 1 runout is performed.
    • When multiple runs are selected, the state will be incompatible with the PHH file format, as it stands.
  • New attributes pokerkit.state.State.street_return_index and pokerkit.state.State.street_return_count that internally keeps track what street to return to and how many times to do so during multiple runouts.

  • New attribute pokerkit.state.State.runout_count that shows the players' preferences on the number of runouts. It maybe None in which case the runout selection was skipped due to the state being of tournament mode or all players showed no preference by passing in None (or leaving empty) for the runout_count argument during the corresponding method call of pokerkit.state.select_runout_count().

  • New attributes pokerkit.state.State.board_count and pokerkit.state.State.board_indices on the number of boards and the range of its indices. The number of boards is at least 1 but may be more due to multiple runouts or the variant being played.

  • New method pokerkit.state.State.get_board_cards(board_index: int) on getting the board_index'th board.

    • The maximum number of boards is either equal to the number of boards of the variant or (in case of multiple runouts) the product of it and the number of runouts.
  • New attribute pokerkit.state.State.runout_count_selector_statuses that keeps track of who can select the number of runouts.

  • New attribute pokerkit.state.State.runout_count_selection_flag that keeps track of whether the runout count selection has been carried out.

  • In pokerkit.utilities.rake, added parameters state, cap, and no_flop_no_drop, and rake is now renamed as percentage and is a keyword parameter.

  • New attributes pokerkit.state.Pot.raked_amount and pokerkit.state.Pot.unraked_amount that gives the raked and the unraked amounts of the pot.

  • New property pokerkit.state.ChipsPushing.unraked_amount.

v0.5.0-alpha.0

24 Apr 10:34
Compare
Choose a tag to compare

This version release introduces a number of backward incompatible changes. Please read the below content carefully!

Summary of changes

  • Minor cleanup that may break older code.

  • Option to choose cash-game vs. tournament (default) mode (defaults to tournament mode).

    • Unlike in tourneys, in cash-games, players can select the number of runouts during all-in situations or opt to not show their hand after an all-in.
  • Option to choose the number of runouts during all-in situations (disabled in tournament mode).

    • In theory, people choose number of runouts before they show their hands. But, this isn't always followed. It is also unclear who must select the number of runouts first. As such, after all-in, when showdown takes place,
  • Multi-board games.

  • More degree of freedom in hole dealing/showdown order.

  • Docstring and documentation overhaul.

Changed

  • The parameters divmod, and rake for relevant poker game/state initialization methods are now keyword-only arguments. Before, one could supply them as positional arguments but this is no longer allowed!

  • pokerkit.state.State.board_cards (previously list[Card]) is now of type list[list[Card]].

    • For example, if an all-in happens on the flop (AsKsQs) and is run twice (JsTs, JhTh), state.board_cards == [[As], [Ks], [Qs], [Js, Jh], [Ts, Th]]. Or, when double board omaha is played, something like state.board_cards == [[??, ??], [??, ??], [??, ??]] will develop after the flop.
    • The function signatures for pokerkit.state.State.get_hand, pokerkit.state.State.get_up_hand, and pokerkit.state.State.get_up_hands now also requires the board_index to be supplied.
    • The properties/method pokerkit.state.State.reserved_cards, pokerkit.state.State.cards_in_play, pokerkit.state.State.cards_not_in_play, and pokerkit.state.State.get_dealable_cards(deal_count: int) now return Iterator[Card] instead of tuple[Card, ...].
    • The method triplets for the hole dealing and showdown operation pokerkit.state.State.verify_hole_dealing(), pokerkit.state.State.can_deal_hole(), pokerkit.state.State.deal_hole(), pokerkit.state.State.verify_hole_cards_showing_or_mucking(), pokerkit.state.State.can_show_or_muck_hole_cards(), and pokerkit.state.State.show_or_muck_hole_cards() also accepts an optional positional argument player_index to control the dealee, or the showdown performer. The verifiers also returns a player dealt if the dealee is not specified.
  • The card-burning-related methods pokerkit.state.State.verify_card_burning, pokerkit.state.State.can_burn_card, and pokerkit.state.State.burn_card also accept a singleton card iterable.

  • The pokerkit.state.State.all_in_show_status was renamed to pokerkit.state.State.all_in_status.

Added

  • New enum class pokerkit.state.State.Mode for setting tournament/cash-game mode while initializing poker states.

    • Tournament mode: pokerkit.state.Mode.TOURNAMENT

    • Cash-game mode: pokerkit.state.Mode.CASH_GAME

      • In all-in situations, players have a chance to choose the number of runouts during showdown.
  • New parameter mode in relevant poker game/state initialization methods. It defaults to tournament mode.

  • New parameter starting_board_count in relevant poker game/state initialization methods. It defaults to 1. This allow multiple boards to be dealt if wished.

  • New automation pokerkit.state.State.Automation.RUNOUT_COUNT_SELECTION which instructs PokerKit to carry out only one run-out.

  • New pokerkit.state.RunoutCountSelection operation.

    • Arguments: runout_count and player_index who gives out the selection.
    • Querier: pokerkit.state.State.can_select_runout_count(player_index: int | None = None, runout_count: int | None = None).
    • Validator: pokerkit.state.State.verify_runout_count_selection(player_index: int | None = None, runout_count: int | None = None).
    • Operator: pokerkit.state.State.select_runout_count(player_index: int | None = None, runout_count: int | None = None, *, commentary: str | None = None).
    • People who can select run count: pokerkit.state.State.runout_count_selector_indices.
    • If runout_count are in disagreement among active players, only 1 runout is performed.
    • When multiple runs are selected, the state will be incompatible with the PHH file format, as it stands.
  • New attributes pokerkit.state.State.street_return_index and pokerkit.state.State.street_return_count that internally keeps track what street to return to and how many times to do so during multiple runouts.

  • New attribute pokerkit.state.State.runout_count that shows the players' preferences on the number of runouts. It maybe None in which case the runout selection was skipped due to the state being of tournament mode or all players showed no preference by passing in None (or leaving empty) for the runout_count argument during the corresponding method call of pokerkit.state.select_runout_count().

  • New attributes pokerkit.state.State.board_count and pokerkit.state.State.board_indices on the number of boards and the range of its indices. The number of boards is at least 1 but may be more due to multiple runouts or the variant being played.

  • New method pokerkit.state.State.get_board_cards(board_index: int) on getting the board_index'th board.

    • The maximum number of boards is either equal to the number of boards of the variant or (in case of multiple runouts) the product of it and the number of runouts.
  • New attribute pokerkit.state.State.runout_count_selector_statuses that keeps track of who can select the number of runouts.

  • New attribute pokerkit.state.State.runout_count_selection_flag that keeps track of whether the runout count selection has been carried out.

v0.4.17

09 Apr 09:23
Compare
Choose a tag to compare

Changed

  • Make error/warning messages more descriptive.

Added

  • Censored hole cards pokerkit.state.State.get_censored_hole_cards().
  • Turn index pokerkit.state.State.turn_index.

v0.4.16

05 Apr 08:48
Compare
Choose a tag to compare

Added

  • Restore action notation pn sm - for showing hole cards.