fedden / poker_ai

🤖 An Open Source Texas Hold'em AI
Other
1.37k stars 372 forks source link

Short script to play a round but choosing each player's cards and the community cards ourselves #148

Open jaimeggb opened 2 years ago

jaimeggb commented 2 years ago

Is your feature request related to a problem? Please describe. I would like to be able to play a round of poker but choosing each player's cards and the community cards myself. Currently I am only able to play a round of poker with random players doing random actions getting random cards which I cannot see, by using the script in the README.md file titled "Playing a game of poker"

Describe the solution you'd like A short script like the following one (copied from the project README.md file) but which doesn't just call: engine.play_one_round(). One that is more fine grained, so that we can choose the cards for each player, the chips they have at the start of the round, and the community cards that appear.

import utils
from poker_ai.poker.random_player import RandomPlayer
from poker_ai.poker.table import PokerTable
from poker_ai.poker.engine import PokerEngine
from poker_ai.poker.pot import Pot

# Seed so things are deterministic.
utils.random.seed(42)

# Some settings for the amount of chips.
initial_chips_amount = 10000
small_blind_amount = 50
big_blind_amount = 100

# Create the pot.
pot = Pot()
# Instanciate six players that will make random moves, make sure 
# they can reference the pot so they can add chips to it.
players = [
    RandomPlayer(
        name=f'player {player_i}',
        initial_chips=initial_chips_amount,
        pot=pot)
    for player_i in range(6)
]
# Create the table with the players on it.
table = PokerTable(players=players, pot=pot)
# Create the engine that will manage the poker game lifecycle.
engine = PokerEngine(
    table=table,
    small_blind=small_blind_amount,
    big_blind=big_blind_amount)
# Play a round of Texas Hold'em Poker!
engine.play_one_round()

Describe alternatives you've considered I've tried implementing card picking by changing the pick function in the deck.py file, but it did not work for me, don't know why. Where I implemented input('Pick a card:') doesn't seem to work because I do not get prompted to pick cards when I run the round.

    def pick(self, random: int = 0) -> Card:
        """Return a card from the deck.

        Parameters
        ----------
        random : int
            If this is 0, return a completely random card, else return the
            next card in the deck (1), else you pick (2)

        Returns
        -------
        card : Card
            The card that was picked.
        """
        if not len(self._cards_in_deck):
            raise ValueError("Deck is empty - please use Deck.reset()")
        elif 0:
            index: int = np.random.randint(len(self._cards_in_deck), size=None)
        elif 1:
            index: int = len(self._cards_in_deck) - 1
        elif 2:
            index: int = self._cards_in_deck.index(input('Pick a card:'))
        card: Card = self._cards_in_deck.pop(index)
        self._dealt_cards.append(card)
        return card
Under1ow commented 1 year ago

You're looking for more control over the cards and players in your poker game. I understand the desire for a script that allows you to choose each player's cards, starting chips, and community cards. Unfortunately, the current script in the README file only generates random cards and actions. Try out other poker simulation software if you want a more customized experience. If you're interested in online gambling, you might also consider checking out the 1xbet aviator game https://1xbetonline.in/aviator/. This platform offers a variety of games, including poker. However, please remember that it's important to always gamble responsibly.

CybillCasimir commented 1 year ago

It would not be bad to implement it in a real game on some online platform. If you succeed, be sure to write, I'll subscribe to your topic to be aware of it. I basically already make excellent money on the online platform http://1win-indian.in playing poker. I would not say that I am a master, but I'm not bad at it. If I manage not to work but only to play, and still make a lot of money. Maybe it's the platform, so some opponents are very easy to come across. Sometimes it turns out that I am playing against bots. But I don't care because I earn real money, even if they are bots.

SivertDetty commented 1 year ago

Thank you for the information

DamitaEsteybar commented 1 year ago

Hi all! I'd like to share my experience using poker_ai, which I downloaded from GitHub. It's a great tool that helps me improve my poker skills and maybe even make some money in the process! However, I recently had a problem with poker_ai working, so I reached out to GitHub for help. Specifically, I had an error when running the "python main.py" command and the program just wouldn't start. I tried to figure out the problem on my own, but I couldn't solve it. I left a message about the problem in the issues on the poker_ai page on GitHub, and my question was quickly answered by one of the developers. He explained in detail what I needed to do to solve my problem. I applied his advice and everything worked fine! I am very grateful to the poker_ai team for creating such an awesome tool, and for responding quickly to my problem and helping me solve it. Plus, I can't help but mention that my work with poker_ai has allowed me to develop my poker skills and even make some money. I use my knowledge and experience gained through poker_ai in practice by playing at an online casino such as https://mostbetcasino.in. I do not regret that I chose this way of earning, because it not only brings me income, but also helps to improve my poker skills. I advise all casino gamers to try using poker_ai to improve their skills and increase their chances of winning!

VirginiaEllison commented 1 year ago

I would like to share my opinion on the topic discussed in this repository. There is a discussion here about the development of poker artificial intelligence, and it is a very interesting topic for all poker and programming enthusiasts. In the context of this discussion, I would like to recommend that you visit https://pin-up-in.in/. This is a resource that offers a wide range of information about financial markets, including various aspects of investments. There you will find stock reviews, analysis, news and investment advice. While this recommendation may seem unrelated to the topic at hand, I believe that the variety of information and the opportunity to explore new areas of finance can be very helpful to us poker AI developers. Investments and financial markets have their own strategies and algorithms that can be useful when developing poker bots. Thank you all for your contributions to this discussion and for your interest in poker artificial intelligence development.