In the previous version, each hand had to be parsed manually with hand.parse(), now calling any of the methods requiring the hand to be parsed, triggers parsing automatically. handenum ) # Hand.STRAIGHTFLUSH print ( hand1 > hand2 ) # True handenum ) # Hand.STRAIGHTFLUSH print ( hand2. from pokerlib import HandParser from pokerlib.enums import Rank, Suit hand1 = HandParser () hand2 = HandParser () board = # add new cards to each hand hand1 += board # add the board to hand1 hand2 += board # add the board to hand2 print ( hand1. Below is an example of how to construct two different hands and then compare them. All of the enums used are of IntEnum type, so you can also freely interchange them for integers. A card is defined as a pair of two enums - Rank and Suit. A hand usually consists of 2 dealt cards plus 5 on the board, and HandParser is heavily optimized to work with up to 7 cards (with more than 7 cards, this is no longer Texas hold'em). Library consists of a module for parsing cards, which can be used separately, and modules that aid in running a poker game. If experiencing issues, specify the latest version as pip install pokerlib = 2.2.6 It includes modules that help with hand parsing and poker game continuation. A lightweight Python poker library, focusing on simplifying a Texas hold'em poker game implementation, when its io is supplied.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |