Skip to content

Commit

Permalink
update example for graphic
Browse files Browse the repository at this point in the history
  • Loading branch information
fschlatt committed Jan 10, 2021
1 parent bc9bac5 commit 160bb88
Showing 1 changed file with 41 additions and 30 deletions.
71 changes: 41 additions & 30 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,45 @@
import random
import time

import clubs

# 1-2 no limit 6 player texas hold'em
config = clubs.configs.NO_LIMIT_HOLDEM_SIX_PLAYER
dealer = clubs.poker.Dealer(**config)
obs = dealer.reset()

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"]
# largest number of chips a player is allowed to bet for a raise
max_raise = obs["max_raise"]

rand = random.random()
# 10% chance to fold
if rand < 0.1:
bet = 0
# 80% chance to call
elif rand < 0.80:
bet = call
# 10% to raise
else:
bet = random.randint(min_raise, max_raise)

obs, rewards, done = dealer.step(bet)

if all(done):
break

print(rewards)

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()

0 comments on commit 160bb88

Please sign in to comment.