-
Notifications
You must be signed in to change notification settings - Fork 3
/
p_dummy.py
38 lines (32 loc) · 1.07 KB
/
p_dummy.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
35
36
37
# p_dummy.py -- just look at my hand, don't remember anything, no randomness
from monkeystud import rank_suit, hand_value, best_hand_value, hand_value_class, PAIR, STR, FLUSH, TRIP, STRF
def play(player_id, hand, history):
# just two cards? call any pair, fold otherwise
#
if 2 == len(hand):
rank0, suit0 = rank_suit(hand[0])
rank1, suit1 = rank_suit(hand[1])
if rank0 == rank1:
return 'C'
return 'F'
# three cards? bet on a flush or better, call on a pair or straight,
# fold otherwise
#
if 3 == len(hand):
v = hand_value(hand)
c = hand_value_class(v)
if c in (FLUSH, TRIP, STRF):
return 'B'
if c in (PAIR, STR):
return 'C'
return 'F'
# four cards? bet on trips or straight flush, call on a straight or flush, fold otherwise
#
if 4 == len(hand):
v = best_hand_value(hand)
c = hand_value_class(v)
if c in (TRIP, STRF):
return 'B'
if c in (STR, FLUSH):
return 'C'
return 'F'