Skip to content

Commit

Permalink
Update tooling to include reading/loading bulk PHH files
Browse files Browse the repository at this point in the history
  • Loading branch information
AussieSeaweed committed Dec 26, 2024
1 parent 08d0651 commit 5dd3017
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
7 changes: 7 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
@@ -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)
----------------------------------

Expand Down
2 changes: 1 addition & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 31 additions & 5 deletions tooling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,34 @@ An example code snippet loading a PHH file in `PokerKit <https://doi.org/10.1109
from pokerkit import *
# Hand loading
with open("...", "rb") as file:
# Load hand
with open("path/to/file.phh", "rb") as file:
hh = HandHistory.load(file)
# Iterate through each action step
for state in hh:
...
An example code snippet loading a bulk PHH file in `PokerKit <https://doi.org/10.1109/TG.2023.3325637>`_ 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 <https://doi.org/10.1109/TG.2023.3325637>`_ is shown below. This hand, played between `Viktor Blom and Patrik Antonius <https://www.cardschat.com/news/10-largest-online-poker-pots-93487/>`_, holds the record for the largest online poker pot ever played.

.. code-block:: python
from pokerkit import *
A = Automation
# Game state construction
game = PotLimitOmahaHoldem(
Expand Down Expand Up @@ -75,6 +88,19 @@ An example code snippet dumping a PHH file in `PokerKit <https://doi.org/10.1109
game, state,
)
hh.players = ["Patrik Antonius", "Viktor Blom"]
# Dump hand
with open("...", "wb") as file:
with open("path/to/file.phh", "wb") as file:
hh.dump(file)
An example code snippet dumping a bulk PHH file in `PokerKit <https://doi.org/10.1109/TG.2023.3325637>`_ 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)

0 comments on commit 5dd3017

Please sign in to comment.