From 5dd30178f7c101929de5b43f5515a282227b1c32 Mon Sep 17 00:00:00 2001 From: Juho Kim Date: Thu, 26 Dec 2024 14:18:06 -0500 Subject: [PATCH] Update tooling to include reading/loading bulk PHH files --- changelog.rst | 7 +++++++ conf.py | 2 +- tooling.rst | 36 +++++++++++++++++++++++++++++++----- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/changelog.rst b/changelog.rst index cca0559..896a216 100644 --- a/changelog.rst +++ b/changelog.rst @@ -1,6 +1,13 @@ Changelog ========= +Version 0.0.2 (December 26, 2024) +---------------------------------- + +**Added** + +- Example ``pokerkit`` usage for bulk PHH file reading and writing. + Version 0.0.1 (September 19, 2024) ---------------------------------- diff --git a/conf.py b/conf.py index 8f06a07..b112b82 100644 --- a/conf.py +++ b/conf.py @@ -9,7 +9,7 @@ project = 'Poker Hand History File Format Specification' copyright = '2024, Juho Kim' author = 'Juho Kim' -release = '0.0.1' +release = '0.0.2' # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/tooling.rst b/tooling.rst index 9a5ed9b..d1789e7 100644 --- a/tooling.rst +++ b/tooling.rst @@ -12,21 +12,34 @@ An example code snippet loading a PHH file in `PokerKit `_ is shown below. + +.. code-block:: python + + from pokerkit import * + + # Load hands + with open("path/to/file.phhs", "rb") as file: + hhs = HandHistory.load_all(file) + + # Iterate through each hand history + for hh in hhs: + ... An example code snippet dumping a PHH file in `PokerKit `_ is shown below. This hand, played between `Viktor Blom and Patrik Antonius `_, holds the record for the largest online poker pot ever played. .. code-block:: python from pokerkit import * + A = Automation # Game state construction game = PotLimitOmahaHoldem( @@ -75,6 +88,19 @@ An example code snippet dumping a PHH file in `PokerKit `_ is shown below. + +.. code-block:: python + + from pokerkit import * + + hhs = [...] + + # Dump hands + with open("path/to/file.phhs", "wb") as file: + HandHistory.dump_all(hhs, file)