PokerKit ist eine in reinem Python geschriebene Open-Source-Softwarebibliothek zur Simulation von Spielen, zur Auswertung von Händen und zur Erleichterung statistischer Analysen, die von der University of Toronto Computer Poker Student Research Group entwickelt wurde. PokerKit unterstützt eine umfangreiche Palette an Pokervarianten und bietet Benutzern eine flexible Architektur zum Definieren ihrer benutzerdefinierten Spiele. Diese Funktionen werden über eine intuitive, einheitliche High-Level-Programmier-API bereitgestellt. Die Bibliothek kann in einer Vielzahl von Anwendungsfällen verwendet werden, von der Poker-KI-Entwicklung und der Tool-Erstellung bis hin zur Online-Poker-Casino-Implementierung. Die Zuverlässigkeit von PokerKit wurde durch statische Typprüfung, umfangreiche Doctests und Unit-Tests nachgewiesen und erreichte eine Codeabdeckung von 99 %.
Die PokerKit-Bibliothek erfordert Python Version 3.11 oder höher und kann mit pip installiert werden:
pip install pokerkit
Beispielanwendungen von PokerKit werden unten gezeigt.
Unten sehen Sie die 4-Runout-Hand zwischen Phil Hellmuth und dem Loose Cannon Ernest Wiggins.
Link: https://youtu.be/cnjJv7x0HMY?si=4l05Ez7lQVczt8DI&t=638
Beachten Sie, dass die Startstapel für einige Spieler auf math.inf
eingestellt sind, da sie nicht erwähnt werden.
from math import inf
from pokerkit import Automation , Mode , NoLimitTexasHoldem
state = NoLimitTexasHoldem . create_state (
# Automations
(
Automation . ANTE_POSTING ,
Automation . BET_COLLECTION ,
Automation . BLIND_OR_STRADDLE_POSTING ,
Automation . HOLE_CARDS_SHOWING_OR_MUCKING ,
Automation . HAND_KILLING ,
Automation . CHIPS_PUSHING ,
Automation . CHIPS_PULLING ,
),
False , # Uniform antes?
{ - 1 : 600 }, # Antes
( 200 , 400 , 800 ), # Blinds or straddles
400 , # Min-bet
( inf , 116400 , 86900 , inf , 50000 , inf ), # Starting stacks
6 , # Number of players
mode = Mode . CASH_GAME ,
)
Nachfolgend finden Sie die Pre-Flop-Handlungen und -Aktionen.
state . deal_hole ( 'JsTh' ) # Tony G
state . deal_hole ( 'Ah9d' ) # Hellmuth
state . deal_hole ( 'KsKc' ) # Wiggins
state . deal_hole ( '5c2h' ) # Negreanu
state . deal_hole ( '6h5h' ) # Brunson
state . deal_hole ( '6s3s' ) # Laak
state . fold () # Negreanu
state . complete_bet_or_raise_to ( 2800 ) # Brunson
state . fold () # Laak
state . check_or_call () # Tony G
state . complete_bet_or_raise_to ( 12600 ) # Hellmuth
state . check_or_call () # Wiggins
state . check_or_call () # Brunson
state . check_or_call () # Tony G
Nachfolgend finden Sie die Flop-Austeilung und -Aktionen.
state . burn_card ( '??' )
state . deal_board ( '9hTs9s' )
state . check_or_call () # Tony G
state . complete_bet_or_raise_to ( 17000 ) # Hellmuth
state . complete_bet_or_raise_to ( 36000 ) # Wiggins
state . fold () # Brunson
state . fold () # Tony G
state . complete_bet_or_raise_to ( 103800 ) # Hellmuth
state . check_or_call () # Wiggins
Unten wird die Anzahl der Ausschläge ausgewählt.
state . select_runout_count ( 4 ) # Hellmuth
state . select_runout_count ( None ) # Wiggins
Unten ist der erste Runout.
state . burn_card ( '??' )
state . deal_board ( 'Jh' ) # Turn
state . burn_card ( '??' )
state . deal_board ( 'Ad' ) # River
Unten ist der zweite Runout.
state . burn_card ( '??' )
state . deal_board ( 'Kh' ) # Turn
state . burn_card ( '??' )
state . deal_board ( '3c' ) # River
Unten ist der dritte Runout.
state . burn_card ( '??' )
state . deal_board ( '7s' ) # Turn
state . burn_card ( '??' )
state . deal_board ( '8s' ) # River
Unten ist der vierte Runout.
state . burn_card ( '??' )
state . deal_board ( 'Qc' ) # Turn
state . burn_card ( '??' )
state . deal_board ( 'Kd' ) # River
Nachfolgend finden Sie die endgültigen Stapel.
print ( state . stacks ) # [inf, 79400, 149700, inf, 37400, inf]
Unten sehen Sie den ersten im Fernsehen übertragenen Millionen-Dollar-Pot zwischen Tom Dwan und Phil Ivey.
Link: https://youtu.be/GnxFohpljqM
Beachten Sie, dass der Startstapel von Patrik Antonius auf math.inf
eingestellt ist, da dies nicht erwähnt wird.
from math import inf
from pokerkit import Automation , NoLimitTexasHoldem
state = NoLimitTexasHoldem . create_state (
# Automations
(
Automation . ANTE_POSTING ,
Automation . BET_COLLECTION ,
Automation . BLIND_OR_STRADDLE_POSTING ,
Automation . HOLE_CARDS_SHOWING_OR_MUCKING ,
Automation . HAND_KILLING ,
Automation . CHIPS_PUSHING ,
Automation . CHIPS_PULLING ,
),
True , # Uniform antes?
500 , # Antes
( 1000 , 2000 ), # Blinds or straddles
2000 , # Min-bet
( 1125600 , inf , 553500 ), # Starting stacks
3 , # Number of players
)
Nachfolgend finden Sie die Pre-Flop-Handlungen und -Aktionen.
state . deal_hole ( 'Ac2d' ) # Ivey
state . deal_hole ( '????' ) # Antonius
state . deal_hole ( '7h6h' ) # Dwan
state . complete_bet_or_raise_to ( 7000 ) # Dwan
state . complete_bet_or_raise_to ( 23000 ) # Ivey
state . fold () # Antonius
state . check_or_call () # Dwan
Nachfolgend finden Sie die Flop-Austeilung und -Aktionen.
state . burn_card ( '??' )
state . deal_board ( 'Jc3d5c' )
state . complete_bet_or_raise_to ( 35000 ) # Ivey
state . check_or_call () # Dwan
Nachfolgend finden Sie die Spielzüge und Aktionen.
state . burn_card ( '??' )
state . deal_board ( '4h' )
state . complete_bet_or_raise_to ( 90000 ) # Ivey
state . complete_bet_or_raise_to ( 232600 ) # Dwan
state . complete_bet_or_raise_to ( 1067100 ) # Ivey
state . check_or_call () # Dwan
Nachfolgend finden Sie den Flusshandel.
state . burn_card ( '??' )
state . deal_board ( 'Jh' )
Nachfolgend finden Sie die endgültigen Stapel.
print ( state . stacks ) # [572100, inf, 1109500]
Unten sehen Sie eine All-in-Hand zwischen Xuan und Phua.
Link: https://youtu.be/QlgCcphLjaQ
from pokerkit import Automation , NoLimitShortDeckHoldem
state = NoLimitShortDeckHoldem . create_state (
# Automations
(
Automation . ANTE_POSTING ,
Automation . BET_COLLECTION ,
Automation . BLIND_OR_STRADDLE_POSTING ,
Automation . HOLE_CARDS_SHOWING_OR_MUCKING ,
Automation . HAND_KILLING ,
Automation . CHIPS_PUSHING ,
Automation . CHIPS_PULLING ,
),
True , # Uniform antes?
3000 , # Antes
{ - 1 : 3000 }, # Blinds or straddles
3000 , # Min-bet
( 495000 , 232000 , 362000 , 403000 , 301000 , 204000 ), # Starting stacks
6 , # Number of players
)
Nachfolgend finden Sie die Pre-Flop-Handlungen und -Aktionen.
state . deal_hole ( 'Th8h' ) # Badziakouski
state . deal_hole ( 'QsJd' ) # Zhong
state . deal_hole ( 'QhQd' ) # Xuan
state . deal_hole ( '8d7c' ) # Jun
state . deal_hole ( 'KhKs' ) # Phua
state . deal_hole ( '8c7h' ) # Koon
state . check_or_call () # Badziakouski
state . check_or_call () # Zhong
state . complete_bet_or_raise_to ( 35000 ) # Xuan
state . fold () # Jun
state . complete_bet_or_raise_to ( 298000 ) # Phua
state . fold () # Koon
state . fold () # Badziakouski
state . fold () # Zhong
state . check_or_call () # Xuan
Nachfolgend finden Sie den Flop-Deal.
state . burn_card ( '??' )
state . deal_board ( '9h6cKc' )
Nachfolgend finden Sie den Turn-Dealing.
state . burn_card ( '??' )
state . deal_board ( 'Jh' )
Nachfolgend finden Sie den Flusshandel.
state . burn_card ( '??' )
state . deal_board ( 'Ts' )
Nachfolgend finden Sie die endgültigen Stapel.
print ( state . stacks ) # [489000, 226000, 684000, 400000, 0, 198000]
Unten sehen Sie den größten Online-Poker-Pot, der jemals zwischen Patrik Antonius und Viktor Blom gespielt wurde.
Link: https://youtu.be/UMBm66Id2AA
from pokerkit import Automation , PotLimitOmahaHoldem
state = PotLimitOmahaHoldem . create_state (
# Automations
(
Automation . ANTE_POSTING ,
Automation . BET_COLLECTION ,
Automation . BLIND_OR_STRADDLE_POSTING ,
Automation . HOLE_CARDS_SHOWING_OR_MUCKING ,
Automation . HAND_KILLING ,
Automation . CHIPS_PUSHING ,
Automation . CHIPS_PULLING ,
),
True , # Uniform antes?
0 , # Antes
( 500 , 1000 ), # Blinds or straddles
1000 , # Min-bet
( 1259450.25 , 678473.5 ), # Starting stacks
2 , # Number of players
)
Nachfolgend finden Sie die Pre-Flop-Handlungen und -Aktionen.
state . deal_hole ( 'Ah3sKsKh' ) # Antonius
state . deal_hole ( '6d9s7d8h' ) # Blom
state . complete_bet_or_raise_to ( 3000 ) # Blom
state . complete_bet_or_raise_to ( 9000 ) # Antonius
state . complete_bet_or_raise_to ( 27000 ) # Blom
state . complete_bet_or_raise_to ( 81000 ) # Antonius
state . check_or_call () # Blom
Nachfolgend finden Sie die Flop-Austeilung und -Aktionen.
state . burn_card ( '??' )
state . deal_board ( '4s5c2h' )
state . complete_bet_or_raise_to ( 91000 ) # Antonius
state . complete_bet_or_raise_to ( 435000 ) # Blom
state . complete_bet_or_raise_to ( 779000 ) # Antonius
state . check_or_call () # Blom
Nachfolgend finden Sie den Turn-Dealing.
state . burn_card ( '??' )
state . deal_board ( '5h' )
Nachfolgend finden Sie den Flusshandel.
state . burn_card ( '??' )
state . deal_board ( '9c' )
Nachfolgend finden Sie die endgültigen Stapel.
print ( state . stacks ) # [1937923.75, 0.0]
Unten sehen Sie einen Bad Beat zwischen Yockey und Arieh.
Link: https://youtu.be/pChCqb2FNxY
from pokerkit import Automation , FixedLimitDeuceToSevenLowballTripleDraw
state = FixedLimitDeuceToSevenLowballTripleDraw . create_state (
# Automations
(
Automation . ANTE_POSTING ,
Automation . BET_COLLECTION ,
Automation . BLIND_OR_STRADDLE_POSTING ,
Automation . HOLE_CARDS_SHOWING_OR_MUCKING ,
Automation . HAND_KILLING ,
Automation . CHIPS_PUSHING ,
Automation . CHIPS_PULLING ,
),
True , # Uniform antes?
0 , # Antes
( 75000 , 150000 ), # Blinds or straddles
150000 , # Small-bet
300000 , # Big-bet
( 1180000 , 4340000 , 5910000 , 10765000 ), # Starting stacks
4 , # Number of players
)
Nachfolgend finden Sie die Pre-Flop-Handlungen und -Aktionen.
state . deal_hole ( '7h6c4c3d2c' ) # Yockey
state . deal_hole ( '??????????' ) # Hui
state . deal_hole ( '??????????' ) # Esposito
state . deal_hole ( 'AsQs6s5c3c' ) # Arieh
state . fold () # Esposito
state . complete_bet_or_raise_to () # Arieh
state . complete_bet_or_raise_to () # Yockey
state . fold () # Hui
state . check_or_call () # Arieh
Nachfolgend finden Sie die erste Ziehung und Aktionen.
state . stand_pat_or_discard () # Yockey
state . stand_pat_or_discard ( 'AsQs' ) # Arieh
state . burn_card ( '??' )
state . deal_hole ( '2hQh' ) # Arieh
state . complete_bet_or_raise_to () # Yockey
state . check_or_call () # Arieh
Unten finden Sie die zweite Ziehung und die Aktionen.
state . stand_pat_or_discard () # Yockey
state . stand_pat_or_discard ( 'Qh' ) # Arieh
state . burn_card ( '??' )
state . deal_hole ( '4d' ) # Arieh
state . complete_bet_or_raise_to () # Yockey
state . check_or_call () # Arieh
Nachfolgend finden Sie die dritte Ziehung und die Aktionen.
state . stand_pat_or_discard () # Yockey
state . stand_pat_or_discard ( '6s' ) # Arieh
state . burn_card ( '??' )
state . deal_hole ( '7c' ) # Arieh
state . complete_bet_or_raise_to () # Yockey
state . check_or_call () # Arieh
Nachfolgend finden Sie die endgültigen Stapel.
print ( state . stacks ) # [0, 4190000, 5910000, 12095000]
Unten sehen Sie ein Beispiel für eine Badugi-Hand aus Wikipedia.
Link: https://en.wikipedia.org/wiki/Badugi
Beachten Sie, dass die Startstapel auf math.inf
festgelegt sind, da sie nicht erwähnt werden.
from math import inf
from pokerkit import Automation , FixedLimitBadugi
state = FixedLimitBadugi . create_state (
# Automations
(
Automation . ANTE_POSTING ,
Automation . BET_COLLECTION ,
Automation . BLIND_OR_STRADDLE_POSTING ,
Automation . HAND_KILLING ,
Automation . CHIPS_PUSHING ,
Automation . CHIPS_PULLING ,
),
True , # Uniform antes?
0 , # Antes
( 1 , 2 ), # Blinds or straddles
2 , # Small-bet
4 , # Big-bet
inf , # Starting stacks
4 , # Number of players
)
Nachfolgend finden Sie die Pre-Flop-Handlungen und -Aktionen.
state . deal_hole ( '????????' ) # Bob
state . deal_hole ( '????????' ) # Carol
state . deal_hole ( '????????' ) # Ted
state . deal_hole ( '????????' ) # Alice
state . fold () # Ted
state . check_or_call () # Alice
state . check_or_call () # Bob
state . check_or_call () # Carol
Nachfolgend finden Sie die erste Ziehung und Aktionen.
state . stand_pat_or_discard ( '????' ) # Bob
state . stand_pat_or_discard ( '????' ) # Carol
state . stand_pat_or_discard ( '??' ) # Alice
state . burn_card ( '??' )
state . deal_hole ( '????' ) # Bob
state . deal_hole ( '????' ) # Carol
state . deal_hole ( '??' ) # Alice
state . check_or_call () # Bob
state . complete_bet_or_raise_to () # Carol
state . check_or_call () # Alice
state . check_or_call () # Bob
Unten finden Sie die zweite Ziehung und die Aktionen.
state . stand_pat_or_discard ( '??' ) # Bob
state . stand_pat_or_discard () # Carol
state . stand_pat_or_discard ( '??' ) # Alice
state . burn_card ( '??' )
state . deal_hole ( '??' ) # Bob
state . deal_hole ( '??' ) # Alice
state . check_or_call () # Bob
state . complete_bet_or_raise_to () # Carol
state . complete_bet_or_raise_to () # Alice
state . fold () # Bob
state . check_or_call () # Carol
Nachfolgend finden Sie die dritte Ziehung und die Aktionen.
state . stand_pat_or_discard ( '??' ) # Carol
state . stand_pat_or_discard () # Alice
state . burn_card ( '??' )
state . deal_hole ( '??' ) # Carol
state . check_or_call () # Carol
state . complete_bet_or_raise_to () # Alice
state . check_or_call () # Carol
Unten ist der Showdown.
state . show_or_muck_hole_cards ( '2s4c6d9h' ) # Alice
state . show_or_muck_hole_cards ( '3s5d7c8h' ) # Carol
Nachfolgend finden Sie die endgültigen Stapel.
print ( state . stacks ) # [inf, inf, inf, inf]
print ( state . payoffs ) # [-4, 20, 0, -16]
PokerKit verfügt über eine umfassende Testabdeckung, besteht die statische Typprüfung von mypy im strengen Modus und wurde durch umfangreiche Verwendung in realen Szenarien validiert.
Beiträge sind willkommen! Weitere Informationen finden Sie in unserem Beitragsleitfaden.
PokerKit wird unter der MIT-Lizenz vertrieben.
Wenn Sie PokerKit in Ihrer Recherche verwenden, zitieren Sie bitte unsere Bibliothek:
@ARTICLE { 10287546 ,
author = { Kim, Juho } ,
journal = { IEEE Transactions on Games } ,
title = { PokerKit: A Comprehensive Python Library for Fine-Grained Multi-Variant Poker Game Simulations } ,
year = { 2023 } ,
volume = { } ,
number = { } ,
pages = { 1-8 } ,
doi = { 10.1109/TG.2023.3325637 } }