SirRender00 / texasholdem

A pure python package for Texas Hold 'Em poker
https://github.com/SirRender00/texasholdem/
MIT License
76 stars 20 forks source link

Impossible to play with bots only #177

Closed LucasColas closed 1 year ago

LucasColas commented 1 year ago

Hello, I would like to try to do a game of poker where every player is a bot. Here is an example of code I did :

from texasholdem.game.game import TexasHoldEm
from texasholdem.gui.text_gui import TextGUI
from texasholdem.agents.basic import random_agent, call_agent
from texasholdem.evaluator.evaluator import *
from texasholdem.card.deck import Deck

max_players = 6
big_blind = 150
small_blind = big_blind // 2
buyin = 1000
game = TexasHoldEm(buyin=buyin, big_blind=big_blind, small_blind=small_blind, max_players=max_players)
gui = TextGUI(game=game, visible_players=[])

while game.is_game_running():

    game.start_hand()
    while game.is_hand_running():
        game.take_action(*random_agent(game))
        gui.run_step()

However sometimes I was asked to play. Every action should be taken by a random agent but sometimes I have to take the action.

SirRender00 commented 1 year ago

Does this section in the docs answer your question? https://texasholdem.readthedocs.io/en/0.9/guis.html#watching-agents-play

SirRender00 commented 1 year ago

As a note, the gui.run_step() is equivalent to https://texasholdem.readthedocs.io/en/0.9/guis.html#breaking-down-the-steps

LucasColas commented 1 year ago

Does this section in the docs answer your question? https://texasholdem.readthedocs.io/en/0.9/guis.html#watching-agents-play

No. because I have to press enter every time.

SirRender00 commented 1 year ago

Ah, you can skip that by deleting the gui.wait_until_prompted() line

SirRender00 commented 1 year ago

Closing this issue for now, feel free to reopen if there's any more issues