PokerKit es una biblioteca de software de código abierto, escrita en Python puro, para simular juegos, evaluar manos y facilitar el análisis estadístico, desarrollada por el Grupo de Investigación de Estudiantes de Computer Poker de la Universidad de Toronto. PokerKit admite una amplia gama de variantes de póquer y proporciona una arquitectura flexible para que los usuarios definan sus juegos personalizados. Estas instalaciones se exponen a través de una API programática unificada e intuitiva de alto nivel. La biblioteca se puede utilizar en una variedad de casos de uso, desde el desarrollo de inteligencia artificial para el póquer y la creación de herramientas hasta la implementación de un casino de póquer en línea. La confiabilidad de PokerKit se ha establecido mediante verificación de tipos estáticos, pruebas documentales exhaustivas y pruebas unitarias, logrando una cobertura de código del 99%.
La biblioteca PokerKit requiere Python versión 3.11 o superior y se puede instalar usando pip:
pip install pokerkit
A continuación se muestran ejemplos de usos de PokerKit.
A continuación se muestra la mano de 4 runouts entre Phil Hellmuth y el Loose Cannon Ernest Wiggins.
Enlace: https://youtu.be/cnjJv7x0HMY?si=4l05Ez7lQVczt8DI&t=638
Tenga en cuenta que las pilas iniciales para algunos jugadores están configuradas en math.inf
ya que no se mencionan.
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 ,
)
A continuación se muestran los tratos y acciones pre-flop.
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
A continuación se muestran las acciones y el reparto del flop.
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
A continuación se muestra la selección del número de escurrimientos.
state . select_runout_count ( 4 ) # Hellmuth
state . select_runout_count ( None ) # Wiggins
A continuación se muestra el primer agotamiento.
state . burn_card ( '??' )
state . deal_board ( 'Jh' ) # Turn
state . burn_card ( '??' )
state . deal_board ( 'Ad' ) # River
A continuación se muestra el segundo agotamiento.
state . burn_card ( '??' )
state . deal_board ( 'Kh' ) # Turn
state . burn_card ( '??' )
state . deal_board ( '3c' ) # River
A continuación se muestra el tercer agotamiento.
state . burn_card ( '??' )
state . deal_board ( '7s' ) # Turn
state . burn_card ( '??' )
state . deal_board ( '8s' ) # River
A continuación se muestra el cuarto agotamiento.
state . burn_card ( '??' )
state . deal_board ( 'Qc' ) # Turn
state . burn_card ( '??' )
state . deal_board ( 'Kd' ) # River
A continuación se muestran las pilas finales.
print ( state . stacks ) # [inf, 79400, 149700, inf, 37400, inf]
A continuación se muestra el primer bote televisado de un millón de dólares entre Tom Dwan y Phil Ivey.
Enlace: https://youtu.be/GnxFohpljqM
Tenga en cuenta que la pila inicial de Patrik Antonius está configurada como math.inf
ya que no se menciona.
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
)
A continuación se muestran los tratos y acciones pre-flop.
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
A continuación se muestran las acciones y el reparto del flop.
state . burn_card ( '??' )
state . deal_board ( 'Jc3d5c' )
state . complete_bet_or_raise_to ( 35000 ) # Ivey
state . check_or_call () # Dwan
A continuación se muestran el reparto de turnos y las acciones.
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
A continuación se muestra el reparto del río.
state . burn_card ( '??' )
state . deal_board ( 'Jh' )
A continuación se muestran las pilas finales.
print ( state . stacks ) # [572100, inf, 1109500]
A continuación se muestra una mano all-in entre Xuan y Phua.
Enlace: 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
)
A continuación se muestran los tratos y acciones pre-flop.
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
A continuación se muestra el reparto del flop.
state . burn_card ( '??' )
state . deal_board ( '9h6cKc' )
A continuación se muestra el reparto de turnos.
state . burn_card ( '??' )
state . deal_board ( 'Jh' )
A continuación se muestra el reparto del río.
state . burn_card ( '??' )
state . deal_board ( 'Ts' )
A continuación se muestran las pilas finales.
print ( state . stacks ) # [489000, 226000, 684000, 400000, 0, 198000]
A continuación se muestra el bote de póquer en línea más grande jamás jugado entre Patrik Antonius y Viktor Blom.
Enlace: 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
)
A continuación se muestran los tratos y acciones pre-flop.
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
A continuación se muestran las acciones y el reparto del flop.
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
A continuación se muestra el reparto de turnos.
state . burn_card ( '??' )
state . deal_board ( '5h' )
A continuación se muestra el reparto del río.
state . burn_card ( '??' )
state . deal_board ( '9c' )
A continuación se muestran las pilas finales.
print ( state . stacks ) # [1937923.75, 0.0]
A continuación se muestra un bad beat entre Yockey y Arieh.
Enlace: 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
)
A continuación se muestran los tratos y acciones pre-flop.
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
A continuación se muestran el primer sorteo y las acciones.
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
A continuación se muestran el segundo sorteo y las acciones.
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
A continuación se muestran el tercer sorteo y las acciones.
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
A continuación se muestran las pilas finales.
print ( state . stacks ) # [0, 4190000, 5910000, 12095000]
A continuación se muestra un ejemplo de mano badugi de Wikipedia.
Enlace: https://en.wikipedia.org/wiki/Badugi
Tenga en cuenta que las pilas iniciales están configuradas en math.inf
ya que no se mencionan.
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
)
A continuación se muestran los tratos y acciones pre-flop.
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
A continuación se muestran el primer sorteo y las acciones.
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
A continuación se muestran el segundo sorteo y las acciones.
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
A continuación se muestran el tercer sorteo y las acciones.
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
A continuación se muestra el enfrentamiento.
state . show_or_muck_hole_cards ( '2s4c6d9h' ) # Alice
state . show_or_muck_hole_cards ( '3s5d7c8h' ) # Carol
A continuación se muestran las pilas finales.
print ( state . stacks ) # [inf, inf, inf, inf]
print ( state . payoffs ) # [-4, 20, 0, -16]
PokerKit tiene una amplia cobertura de pruebas, pasa la verificación de tipo estático mypy con modo estricto y ha sido validado mediante un uso extensivo en escenarios de la vida real.
¡Las contribuciones son bienvenidas! Lea nuestra Guía de contribución para obtener más información.
PokerKit se distribuye bajo la licencia MIT.
Si utiliza PokerKit en su investigación, cite nuestra biblioteca:
@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 } }