-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexample.py
45 lines (33 loc) · 919 Bytes
/
example.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
38
39
40
41
42
43
44
45
import random
import time
import clubs
def main():
# 1-2 no limit 6 player texas hold'em
config = clubs.configs.NO_LIMIT_HOLDEM_NINE_PLAYER
dealer = clubs.poker.Dealer(**config)
obs = dealer.reset()
dealer.render()
time.sleep(1)
while True:
# number of chips a player must bet to call
call = obs["call"]
# smallest number of chips a player is allowed to bet for a raise
min_raise = obs["min_raise"]
rand = random.random()
# 15% chance to fold
if rand < 0.15:
bet = 0
# 80% chance to call
elif rand < 0.95:
bet = call
# 5% to raise to min_raise
else:
bet = min_raise
obs, rewards, done = dealer.step(bet)
dealer.render()
time.sleep(1)
if all(done):
break
print(rewards)
if __name__ == "__main__":
main()