-
Notifications
You must be signed in to change notification settings - Fork 0
/
x_best_hole_cards.py
34 lines (29 loc) · 955 Bytes
/
x_best_hole_cards.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from deuces.deuces import Deck, Card
from pokermodules.convenience import ring_winners
### Winning cards/hand if all 9 players show down.
### Takes about 38 sec on Intel Core i5 at 3.1 GHz.
### 1 min on my macbook (2.7ghz i7).
for n in range(75000):
deck = Deck()
## Deal the hole cards
ring = []
for i in range(9):
p = deck.draw(2)
p.sort(reverse=True)
ring.append(p)
## Deal board
board = deck.draw(5)
## Show down
[winners, winrank] = ring_winners(board, ring)
for i, hole in enumerate(ring):
hole_str = Card.int_to_str(hole[0])[0] + Card.int_to_str(hole[1])[0]
if Card.get_suit_int(hole[0]) == Card.get_suit_int(hole[1]):
hole_str += 's'
else:
hole_str += 'o'
wl = ''
if i in winners:
wl = 'w'
else:
wl = 'l'
print hole_str + ',' + winrank + ',' + wl + ',' + str(n) + ',' + str(i)