pokerkit 0.7.6__tar.gz → 0.7.7.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/PKG-INFO +1 -1
  2. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/__init__.py +12 -0
  3. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/games.py +169 -1
  4. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/hands.py +45 -1
  5. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/lookups.py +55 -1
  6. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/tests/test_lookups.py +54 -0
  7. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/tests/test_state.py +12 -0
  8. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/tests/test_utilities.py +17 -8
  9. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/utilities.py +41 -5
  10. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit.egg-info/PKG-INFO +1 -1
  11. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/setup.py +1 -1
  12. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/LICENSE +0 -0
  13. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/README.rst +0 -0
  14. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/analysis.py +0 -0
  15. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/notation.py +0 -0
  16. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/py.typed +0 -0
  17. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/state.py +0 -0
  18. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/tests/__init__.py +0 -0
  19. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/tests/test_analysis.py +0 -0
  20. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/tests/test_games.py +0 -0
  21. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/tests/test_notation.py +0 -0
  22. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/tests/test_papers.py +0 -0
  23. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/tests/test_rules.py +0 -0
  24. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/tests/test_wsop/__init__.py +0 -0
  25. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/tests/test_wsop/test_2023_43_5.py +0 -0
  26. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit/tests/test_wsop/test_2023_54_4.py +0 -0
  27. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit.egg-info/SOURCES.txt +0 -0
  28. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit.egg-info/dependency_links.txt +0 -0
  29. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/pokerkit.egg-info/top_level.txt +0 -0
  30. {pokerkit-0.7.6 → pokerkit-0.7.7.dev0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pokerkit
3
- Version: 0.7.6
3
+ Version: 0.7.7.dev0
4
4
  Summary: An open-source Python library for poker game simulations, hand evaluations, and statistical analysis
5
5
  Home-page: https://github.com/uoftcprg/pokerkit
6
6
  Author: Universal, Open, Free, and Transparent Computer Poker Research Group
@@ -59,6 +59,9 @@ __all__ = (
59
59
  'KuhnPokerHand',
60
60
  'KuhnPokerLookup',
61
61
  'Label',
62
+ 'LeducHoldem',
63
+ 'LeducHoldemHand',
64
+ 'LeducHoldemLookup',
62
65
  'Lookup',
63
66
  'max_or_none',
64
67
  'min_or_none',
@@ -69,6 +72,9 @@ __all__ = (
69
72
  'NoLimitShortDeckHoldem',
70
73
  'NoLimitTexasHoldem',
71
74
  'NoOperation',
75
+ 'Numeral211Holdem',
76
+ 'Numeral211HoldemHand',
77
+ 'Numeral211HoldemLookup',
72
78
  'OmahaEightOrBetterLowHand',
73
79
  'OmahaHoldemHand',
74
80
  'OmahaHoldemMixin',
@@ -145,11 +151,13 @@ from pokerkit.games import (
145
151
  FixedLimitTexasHoldem,
146
152
  Holdem,
147
153
  KuhnPoker,
154
+ LeducHoldem,
148
155
  NoLimitDeuceToSevenLowballSingleDraw,
149
156
  NoLimitPokerMixin,
150
157
  NoLimitRoyalHoldem,
151
158
  NoLimitShortDeckHoldem,
152
159
  NoLimitTexasHoldem,
160
+ Numeral211Holdem,
153
161
  OmahaHoldemMixin,
154
162
  Poker,
155
163
  PotLimitOmahaHoldem,
@@ -172,6 +180,8 @@ from pokerkit.hands import (
172
180
  Hand,
173
181
  HoleBoardCombinationHand,
174
182
  KuhnPokerHand,
183
+ LeducHoldemHand,
184
+ Numeral211HoldemHand,
175
185
  OmahaEightOrBetterLowHand,
176
186
  OmahaHoldemHand,
177
187
  RegularLowHand,
@@ -188,7 +198,9 @@ from pokerkit.lookups import (
188
198
  Entry,
189
199
  KuhnPokerLookup,
190
200
  Label,
201
+ LeducHoldemLookup,
191
202
  Lookup,
203
+ Numeral211HoldemLookup,
192
204
  RegularLookup,
193
205
  RhodeIslandHoldemLookup,
194
206
  ShortDeckHoldemLookup,
@@ -16,6 +16,8 @@ from pokerkit.hands import (
16
16
  EightOrBetterLowHand,
17
17
  Hand,
18
18
  KuhnPokerHand,
19
+ LeducHoldemHand,
20
+ Numeral211HoldemHand,
19
21
  OmahaEightOrBetterLowHand,
20
22
  OmahaHoldemHand,
21
23
  RegularLowHand,
@@ -903,7 +905,7 @@ class NoLimitTexasHoldem(
903
905
  class RoyalHoldemMixin:
904
906
  """The mixin for royal hold'em games."""
905
907
 
906
- deck = Deck.ROYAL_POKER
908
+ deck = Deck.ROYAL_HOLDEM
907
909
 
908
910
 
909
911
  class NoLimitRoyalHoldem(RoyalHoldemMixin, NoLimitTexasHoldem):
@@ -2157,6 +2159,111 @@ class KuhnPoker(FixedLimitPokerMixin, Poker):
2157
2159
  return super().__call__(raw_starting_stacks, player_count)
2158
2160
 
2159
2161
 
2162
+ class LeducHoldem(FixedLimitPokerMixin, Poker):
2163
+ """The class for Leduc hold'em games."""
2164
+
2165
+ deck = Deck.LEDUC_HOLDEM
2166
+ hand_types = (LeducHoldemHand,)
2167
+ hole_dealing_count = 1
2168
+ max_completion_betting_or_raising_count = 2
2169
+
2170
+ @classmethod
2171
+ def create_state(
2172
+ cls,
2173
+ automations: tuple[Automation, ...],
2174
+ ante_trimming_status: bool = True,
2175
+ raw_antes: ValuesLike = 1,
2176
+ small_bet: int = 2,
2177
+ big_bet: int = 4,
2178
+ raw_starting_stacks: ValuesLike = 13,
2179
+ player_count: int = 2,
2180
+ *,
2181
+ mode: Mode = Mode.TOURNAMENT,
2182
+ starting_board_count: int = 1,
2183
+ divmod: Callable[[int, int], tuple[int, int]] = divmod,
2184
+ rake: Callable[[int, State], tuple[int, int]] = rake,
2185
+ ) -> State:
2186
+ """Create a Leduc hold'em game.
2187
+
2188
+ :param automations: The automations.
2189
+ :param ante_trimming_status: The ante trimming status.
2190
+ :param raw_antes: The antes.
2191
+ :param small_bet: The small bet.
2192
+ :param big_bet: The big bet.
2193
+ :param raw_starting_stacks: The starting stacks.
2194
+ :param player_count: The number of players.
2195
+ :param mode: The mode.
2196
+ :param starting_board_count: The starting board count.
2197
+ :param divmod: The divmod function.
2198
+ :param rake: The rake function.
2199
+ :return: The created state.
2200
+ """
2201
+ return cls(
2202
+ automations,
2203
+ ante_trimming_status,
2204
+ raw_antes,
2205
+ small_bet,
2206
+ big_bet,
2207
+ mode=mode,
2208
+ starting_board_count=starting_board_count,
2209
+ divmod=divmod,
2210
+ rake=rake,
2211
+ )(raw_starting_stacks, player_count)
2212
+
2213
+ def __init__(
2214
+ self,
2215
+ automations: tuple[Automation, ...],
2216
+ ante_trimming_status: bool = True,
2217
+ raw_antes: ValuesLike = 1,
2218
+ small_bet: int = 2,
2219
+ big_bet: int = 4,
2220
+ raw_starting_stacks: ValuesLike = 13,
2221
+ *,
2222
+ mode: Mode = Mode.TOURNAMENT,
2223
+ starting_board_count: int = 1,
2224
+ divmod: Callable[[int, int], tuple[int, int]] = divmod,
2225
+ rake: Callable[[int, State], tuple[int, int]] = rake,
2226
+ ) -> None:
2227
+ super().__init__(
2228
+ automations,
2229
+ (
2230
+ Street(
2231
+ False,
2232
+ (False,) * self.hole_dealing_count,
2233
+ 0,
2234
+ False,
2235
+ Opening.POSITION,
2236
+ small_bet,
2237
+ self.max_completion_betting_or_raising_count,
2238
+ ),
2239
+ Street(
2240
+ True,
2241
+ (),
2242
+ 1,
2243
+ False,
2244
+ Opening.POSITION,
2245
+ big_bet,
2246
+ self.max_completion_betting_or_raising_count,
2247
+ ),
2248
+ ),
2249
+ ante_trimming_status,
2250
+ raw_antes,
2251
+ 0,
2252
+ 0,
2253
+ mode=mode,
2254
+ starting_board_count=starting_board_count,
2255
+ divmod=divmod,
2256
+ rake=rake,
2257
+ )
2258
+
2259
+ def __call__(
2260
+ self,
2261
+ raw_starting_stacks: ValuesLike = 13,
2262
+ player_count: int = 2,
2263
+ ) -> State:
2264
+ return super().__call__(raw_starting_stacks, player_count)
2265
+
2266
+
2160
2267
  class RhodeIslandHoldem(FixedLimitPokerMixin, Poker):
2161
2268
  """The class for Rhode Island hold'em games."""
2162
2269
 
@@ -2272,3 +2379,64 @@ class RhodeIslandHoldem(FixedLimitPokerMixin, Poker):
2272
2379
 
2273
2380
  class RoyalRhodeIslandHoldem(RoyalHoldemMixin, RhodeIslandHoldem):
2274
2381
  """The class for royal Rhode Island hold'em games."""
2382
+
2383
+
2384
+ class Numeral211Holdem(RhodeIslandHoldem):
2385
+ """The class for Numeral211 hold'em games."""
2386
+
2387
+ deck = Deck.NUMERAL211_HOLDEM
2388
+ hand_types = (Numeral211HoldemHand,)
2389
+ hole_dealing_count = 1
2390
+ max_completion_betting_or_raising_count = 4
2391
+
2392
+ @classmethod
2393
+ def create_state(
2394
+ cls,
2395
+ automations: tuple[Automation, ...],
2396
+ ante_trimming_status: bool = True,
2397
+ raw_antes: ValuesLike = 5,
2398
+ small_bet: int = 10,
2399
+ big_bet: int = 20,
2400
+ raw_starting_stacks: ValuesLike = 205,
2401
+ player_count: int = 2,
2402
+ *,
2403
+ mode: Mode = Mode.TOURNAMENT,
2404
+ starting_board_count: int = 1,
2405
+ divmod: Callable[[int, int], tuple[int, int]] = divmod,
2406
+ rake: Callable[[int, State], tuple[int, int]] = rake,
2407
+ ) -> State:
2408
+ """Create a Numeral211 hold'em game.
2409
+
2410
+ :param automations: The automations.
2411
+ :param ante_trimming_status: The ante trimming status.
2412
+ :param raw_antes: The antes.
2413
+ :param small_bet: The small bet.
2414
+ :param big_bet: The big bet.
2415
+ :param raw_starting_stacks: The starting stacks.
2416
+ :param player_count: The number of players.
2417
+ :param mode: The mode.
2418
+ :param starting_board_count: The starting board count.
2419
+ :param divmod: The divmod function.
2420
+ :param rake: The rake function.
2421
+ :return: The created state.
2422
+ """
2423
+ return super().create_state(
2424
+ automations,
2425
+ ante_trimming_status,
2426
+ raw_antes,
2427
+ small_bet,
2428
+ big_bet,
2429
+ raw_starting_stacks,
2430
+ player_count,
2431
+ mode=mode,
2432
+ starting_board_count=starting_board_count,
2433
+ divmod=divmod,
2434
+ rake=rake,
2435
+ )
2436
+
2437
+ def __call__(
2438
+ self,
2439
+ raw_starting_stacks: ValuesLike = 205,
2440
+ player_count: int = 2,
2441
+ ) -> State:
2442
+ return super().__call__(raw_starting_stacks, player_count)
@@ -13,7 +13,9 @@ from pokerkit.lookups import (
13
13
  EightOrBetterLookup,
14
14
  Entry,
15
15
  KuhnPokerLookup,
16
+ LeducHoldemLookup,
16
17
  Lookup,
18
+ Numeral211HoldemLookup,
17
19
  RegularLookup,
18
20
  RhodeIslandHoldemLookup,
19
21
  ShortDeckHoldemLookup,
@@ -786,8 +788,29 @@ class KuhnPokerHand(CombinationHand):
786
788
  card_count = 1
787
789
 
788
790
 
791
+ class LeducHoldemHand(CombinationHand):
792
+ """The class for Leduc hold'em hands.
793
+
794
+ >>> h0 = LeducHoldemHand('JsQs')
795
+ >>> h1 = LeducHoldemHand('KsJc')
796
+ >>> h2 = LeducHoldemHand('JhJs')
797
+ >>> h3 = LeducHoldemHand('KsKh')
798
+ >>> h0 < h1 < h2 < h3
799
+ True
800
+
801
+ >>> h = LeducHoldemHand('Ks')
802
+ Traceback (most recent call last):
803
+ ...
804
+ ValueError: The cards 'Ks' form an invalid LeducHoldemHand hand.
805
+ """
806
+
807
+ lookup = LeducHoldemLookup()
808
+ low = False
809
+ card_count = 2
810
+
811
+
789
812
  class RhodeIslandHoldemHand(CombinationHand):
790
- """The class for Rhode Island Holdem hands.
813
+ """The class for Rhode Island hold'em hands.
791
814
 
792
815
  >>> h0 = RhodeIslandHoldemHand('JsJc2h')
793
816
  >>> h1 = RhodeIslandHoldemHand('2sQsAs')
@@ -805,3 +828,24 @@ class RhodeIslandHoldemHand(CombinationHand):
805
828
  lookup = RhodeIslandHoldemLookup()
806
829
  low = False
807
830
  card_count = 3
831
+
832
+
833
+ class Numeral211HoldemHand(RhodeIslandHoldemHand):
834
+ """The class for Numeral211 hold'em hands.
835
+
836
+ >>> h0 = Numeral211HoldemHand('Ts8h6c')
837
+ >>> h1 = Numeral211HoldemHand('TsTh8c')
838
+ >>> h2 = Numeral211HoldemHand('Ts8s6s')
839
+ >>> h3 = Numeral211HoldemHand('Ts9h8c')
840
+ >>> h4 = Numeral211HoldemHand('TsThTc')
841
+ >>> h5 = Numeral211HoldemHand('Ts9s8s')
842
+ >>> h0 < h1 < h2 < h3 < h4 < h5
843
+ True
844
+
845
+ >>> h = Numeral211HoldemHand('JsJc2h')
846
+ Traceback (most recent call last):
847
+ ...
848
+ ValueError: The cards 'JsJc2h' form an invalid Numeral211HoldemHand hand.
849
+ """
850
+
851
+ lookup = Numeral211HoldemLookup()
@@ -571,9 +571,38 @@ class KuhnPokerLookup(Lookup):
571
571
  self._add_multisets(Counter({1: 1}), (True,), Label.HIGH_CARD)
572
572
 
573
573
 
574
+ @dataclass
575
+ class LeducHoldemLookup(Lookup):
576
+ """The class for Leduc hold'em hand lookups.
577
+
578
+ Lookups are used by evaluators. If you want to evaluate poker hands,
579
+ please use :class:`pokerkit.hands.LeducHoldemHand`.
580
+
581
+ >>> lookup = LeducHoldemLookup()
582
+ >>> e0 = lookup.get_entry('JsQh')
583
+ >>> e1 = lookup.get_entry('KsKh')
584
+ >>> e2 = lookup.get_entry('QhTs')
585
+ Traceback (most recent call last):
586
+ ...
587
+ ValueError: The cards 'QhTs' form an invalid hand.
588
+ >>> e0 < e1
589
+ True
590
+ >>> e0.label
591
+ <Label.HIGH_CARD: 'High card'>
592
+ >>> e1.label
593
+ <Label.ONE_PAIR: 'One pair'>
594
+ """
595
+
596
+ rank_order = RankOrder.KUHN_POKER
597
+
598
+ def _add_entries(self) -> None:
599
+ self._add_multisets(Counter({1: 2}), (False, True), Label.HIGH_CARD)
600
+ self._add_multisets(Counter({2: 1}), (False, True), Label.ONE_PAIR)
601
+
602
+
574
603
  @dataclass
575
604
  class RhodeIslandHoldemLookup(Lookup):
576
- """The class for Rhode Island Hold'em hand lookups.
605
+ """The class for Rhode Island hold'em hand lookups.
577
606
 
578
607
  Lookups are used by evaluators. If you want to evaluate poker hands,
579
608
  please use :class:`pokerkit.hands.RhodeIslandHoldemHand`.
@@ -602,3 +631,28 @@ class RhodeIslandHoldemLookup(Lookup):
602
631
  self._add_straights(3, (False,), Label.STRAIGHT)
603
632
  self._add_multisets(Counter({3: 1}), (False,), Label.THREE_OF_A_KIND)
604
633
  self._add_straights(3, (True,), Label.STRAIGHT_FLUSH)
634
+
635
+
636
+ @dataclass
637
+ class Numeral211HoldemLookup(RhodeIslandHoldemLookup):
638
+ """The class for Numeral211 hold'em hand lookups.
639
+
640
+ Lookups are used by evaluators. If you want to evaluate poker hands,
641
+ please use :class:`pokerkit.hands.Numeral211HoldemHand`.
642
+
643
+ >>> lookup = Numeral211HoldemLookup()
644
+ >>> e0 = lookup.get_entry('6s7h8c')
645
+ >>> e1 = lookup.get_entry('TsTdTh')
646
+ >>> e2 = lookup.get_entry('3h3c')
647
+ Traceback (most recent call last):
648
+ ...
649
+ ValueError: The cards '3h3c' form an invalid hand.
650
+ >>> e0 < e1
651
+ True
652
+ >>> e0.label
653
+ <Label.STRAIGHT: 'Straight'>
654
+ >>> e1.label
655
+ <Label.THREE_OF_A_KIND: 'Three of a kind'>
656
+ """
657
+
658
+ rank_order = RankOrder.NUMERAL211_HOLDEM
@@ -11,9 +11,12 @@ from pokerkit.lookups import (
11
11
  BadugiLookup,
12
12
  EightOrBetterLookup,
13
13
  KuhnPokerLookup,
14
+ LeducHoldemLookup,
15
+ Numeral211HoldemLookup,
14
16
  RegularLookup,
15
17
  RhodeIslandHoldemLookup,
16
18
  ShortDeckHoldemLookup,
19
+ Standard2Lookup,
17
20
  StandardBadugiLookup,
18
21
  StandardLookup,
19
22
  )
@@ -50,6 +53,23 @@ class StandardLookupTestCase(LookupTestCaseMixin, TestCase):
50
53
  )
51
54
 
52
55
 
56
+ class Standard2LookupTestCase(LookupTestCaseMixin, TestCase):
57
+ def test_get_entry(self) -> None:
58
+ lookup = Standard2Lookup()
59
+ combinations_ = sorted(
60
+ combinations(Deck.STANDARD, 5),
61
+ key=lookup.get_entry,
62
+ )
63
+ string = self.serialize_combinations(combinations_)
64
+ algorithm = md5()
65
+ algorithm.update(string.encode())
66
+
67
+ self.assertEqual(
68
+ algorithm.hexdigest(),
69
+ '3f1565279b892b21f843b9b038ced8f9',
70
+ )
71
+
72
+
53
73
  class ShortDeckHoldemLookupTestCase(LookupTestCaseMixin, TestCase):
54
74
  def test_get_entry(self) -> None:
55
75
  lookup = ShortDeckHoldemLookup()
@@ -172,6 +192,23 @@ class KuhnPokerLookupTestCase(LookupTestCaseMixin, TestCase):
172
192
  )
173
193
 
174
194
 
195
+ class LeducHoldemLookupTestCase(LookupTestCaseMixin, TestCase):
196
+ def test_get_entry(self) -> None:
197
+ lookup = LeducHoldemLookup()
198
+ combinations_ = sorted(
199
+ combinations(Deck.LEDUC_HOLDEM, 2),
200
+ key=lookup.get_entry,
201
+ )
202
+ string = self.serialize_combinations(combinations_)
203
+ algorithm = md5()
204
+ algorithm.update(string.encode())
205
+
206
+ self.assertEqual(
207
+ algorithm.hexdigest(),
208
+ '12148ab771ed5520678f5d28fe65af00',
209
+ )
210
+
211
+
175
212
  class RhodeIslandHoldemLookupTestCase(LookupTestCaseMixin, TestCase):
176
213
  def test_get_entry(self) -> None:
177
214
  lookup = RhodeIslandHoldemLookup()
@@ -189,5 +226,22 @@ class RhodeIslandHoldemLookupTestCase(LookupTestCaseMixin, TestCase):
189
226
  )
190
227
 
191
228
 
229
+ class Numeral211LookupTestCase(LookupTestCaseMixin, TestCase):
230
+ def test_get_entry(self) -> None:
231
+ lookup = Numeral211HoldemLookup()
232
+ combinations_ = sorted(
233
+ combinations(Deck.NUMERAL211_HOLDEM, 3),
234
+ key=lookup.get_entry,
235
+ )
236
+ string = self.serialize_combinations(combinations_)
237
+ algorithm = md5()
238
+ algorithm.update(string.encode())
239
+
240
+ self.assertEqual(
241
+ algorithm.hexdigest(),
242
+ '69fdf0a3b86d2514e6fd335c4c59a90c',
243
+ )
244
+
245
+
192
246
  if __name__ == '__main__':
193
247
  main() # pragma: no cover
@@ -13,9 +13,11 @@ from pokerkit.games import (
13
13
  FixedLimitOmahaHoldemHighLowSplitEightOrBetter,
14
14
  FixedLimitRazz,
15
15
  FixedLimitSevenCardStud,
16
+ LeducHoldem,
16
17
  NoLimitDeuceToSevenLowballSingleDraw,
17
18
  NoLimitShortDeckHoldem,
18
19
  NoLimitTexasHoldem,
20
+ Numeral211Holdem,
19
21
  RhodeIslandHoldem,
20
22
  )
21
23
  from pokerkit.hands import KuhnPokerHand, StandardHighHand
@@ -1828,6 +1830,16 @@ class StateTestCase(TestCase):
1828
1830
  self.assertFalse(state.status)
1829
1831
  self.assertEqual(state.payoffs, [143, 4, -115, -117, -1, 113, -27])
1830
1832
 
1833
+ def test_leduc_holdem(self) -> None:
1834
+ state = LeducHoldem.create_state(tuple(Automation))
1835
+
1836
+ self.assertEqual(state.deck, Deck.LEDUC_HOLDEM)
1837
+
1838
+ def test_numeral211_holdem(self) -> None:
1839
+ state = Numeral211Holdem.create_state(tuple(Automation))
1840
+
1841
+ self.assertEqual(state.deck, Deck.NUMERAL211_HOLDEM)
1842
+
1831
1843
 
1832
1844
  if __name__ == '__main__':
1833
1845
  main() # pragma: no cover
@@ -14,11 +14,13 @@ class RankTestCase(TestCase):
14
14
 
15
15
  class RankOrderTestCase(TestCase):
16
16
  def test_members(self) -> None:
17
- self.assertEqual(''.join(RankOrder.EIGHT_OR_BETTER_LOW), 'A2345678')
18
17
  self.assertEqual(''.join(RankOrder.STANDARD), '23456789TJQKA')
19
18
  self.assertEqual(''.join(RankOrder.SHORT_DECK_HOLDEM), '6789TJQKA')
20
19
  self.assertEqual(''.join(RankOrder.REGULAR), 'A23456789TJQK')
21
- self.assertEqual(''.join(RankOrder.ROYAL_POKER), 'TJQKA')
20
+ self.assertEqual(''.join(RankOrder.EIGHT_OR_BETTER_LOW), 'A2345678')
21
+ self.assertEqual(''.join(RankOrder.KUHN_POKER), 'JQK')
22
+ self.assertEqual(''.join(RankOrder.NUMERAL211_HOLDEM), '23456789TA')
23
+ self.assertEqual(''.join(RankOrder.ROYAL_HOLDEM), 'TJQKA')
22
24
 
23
25
 
24
26
  class SuitTestCase(TestCase):
@@ -60,16 +62,23 @@ class DeckTestCase(TestCase):
60
62
  )
61
63
  self.assertEqual(len(Deck.KUHN_POKER), 3)
62
64
  self.assertCountEqual(Deck.KUHN_POKER, Card.parse('JsQsKs'))
63
- self.assertEqual(len(Deck.ROYAL_POKER), 20)
65
+ self.assertEqual(len(Deck.LEDUC_HOLDEM), 6)
66
+ self.assertCountEqual(Deck.LEDUC_HOLDEM, Card.parse('JhJsQhQsKhKs'))
67
+ self.assertEqual(len(Deck.NUMERAL211_HOLDEM), 40)
64
68
  self.assertCountEqual(
65
- Deck.ROYAL_POKER,
69
+ Deck.NUMERAL211_HOLDEM,
66
70
  Card.parse(
67
- 'TcJcQcKcAc',
68
- 'TdJdQdKdAd',
69
- 'ThJhQhKhAh',
70
- 'TsJsQsKsAs',
71
+ '2c3c4c5c6c7c8c9cTcAc',
72
+ '2d3d4d5d6d7d8d9dTdAd',
73
+ '2h3h4h5h6h7h8h9hThAh',
74
+ '2s3s4s5s6s7s8s9sTsAs',
71
75
  ),
72
76
  )
77
+ self.assertEqual(len(Deck.ROYAL_HOLDEM), 20)
78
+ self.assertCountEqual(
79
+ Deck.ROYAL_HOLDEM,
80
+ Card.parse('TcTdThTsJcJdJhJsQcQdQhQsKcKdKhKsAcAdAhAs'),
81
+ )
73
82
 
74
83
 
75
84
  if __name__ == '__main__':
@@ -188,14 +188,27 @@ class RankOrder(tuple[Rank, ...], Enum):
188
188
  """The eight or better low ranks (from ace to eight)."""
189
189
  KUHN_POKER = Rank.JACK, Rank.QUEEN, Rank.KING
190
190
  """The Kuhn poker ranks (from jack to king)."""
191
- ROYAL_POKER = (
191
+ NUMERAL211_HOLDEM = (
192
+ Rank.DEUCE,
193
+ Rank.TREY,
194
+ Rank.FOUR,
195
+ Rank.FIVE,
196
+ Rank.SIX,
197
+ Rank.SEVEN,
198
+ Rank.EIGHT,
199
+ Rank.NINE,
200
+ Rank.TEN,
201
+ Rank.ACE,
202
+ )
203
+ """The Numeral211 hold'em ranks."""
204
+ ROYAL_HOLDEM = (
192
205
  Rank.TEN,
193
206
  Rank.JACK,
194
207
  Rank.QUEEN,
195
208
  Rank.KING,
196
209
  Rank.ACE,
197
210
  )
198
- """The royal poker ranks (from ten to king)."""
211
+ """The royal hold'em ranks (from ten to king)."""
199
212
 
200
213
 
201
214
  @unique
@@ -601,16 +614,39 @@ class Deck(tuple[Card, ...], Enum):
601
614
  The cards in it are jack of spades, queen of spades, and king of
602
615
  spades.
603
616
  """
604
- ROYAL_POKER = tuple(
617
+ LEDUC_HOLDEM = tuple(
618
+ starmap(
619
+ Card,
620
+ product(RankOrder.KUHN_POKER, (Suit.HEART, Suit.SPADE,)),
621
+ ),
622
+ )
623
+ """The 6-card Leduc hold'em deck cards.
624
+
625
+ The cards in it are jack, queen, and king of hearts and spades.
626
+ """
627
+ NUMERAL211_HOLDEM = tuple(
628
+ starmap(
629
+ Card,
630
+ product(
631
+ RankOrder.NUMERAL211_HOLDEM,
632
+ (Suit.CLUB, Suit.DIAMOND, Suit.HEART, Suit.SPADE),
633
+ ),
634
+ ),
635
+ )
636
+ """The 40-card Numerall211 hold'em deck cards.
637
+
638
+ The ranks are ordered from deuces to aces.
639
+ """
640
+ ROYAL_HOLDEM = tuple(
605
641
  starmap(
606
642
  Card,
607
643
  product(
608
- RankOrder.ROYAL_POKER,
644
+ RankOrder.ROYAL_HOLDEM,
609
645
  (Suit.CLUB, Suit.DIAMOND, Suit.HEART, Suit.SPADE),
610
646
  ),
611
647
  ),
612
648
  )
613
- """The 20-card royal poker deck cards.
649
+ """The 20-card royal hold'em deck cards.
614
650
 
615
651
  The cards in it are ten, jack, queen, king, and ace of each suit.
616
652
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pokerkit
3
- Version: 0.7.6
3
+ Version: 0.7.7.dev0
4
4
  Summary: An open-source Python library for poker game simulations, hand evaluations, and statistical analysis
5
5
  Home-page: https://github.com/uoftcprg/pokerkit
6
6
  Author: Universal, Open, Free, and Transparent Computer Poker Research Group
@@ -4,7 +4,7 @@ from setuptools import find_packages, setup
4
4
 
5
5
  setup(
6
6
  name='pokerkit',
7
- version='0.7.6',
7
+ version='0.7.7.dev0',
8
8
  description=(
9
9
  'An open-source Python library for poker game simulations, hand'
10
10
  ' evaluations, and statistical analysis'
File without changes
File without changes
File without changes