Auction Poker AI - Part 4

PART IV - Bidding, tweaking and the Last card.

The big hole remaining in the AI was bidding.  The AI is constrained to the same limits as the player  - they have the same amount of chips, can only bid in increments of 5 chips and don’t know anybody else’s cards or know which cards are coming up. However, they do know how many cards are remaining in the deck.

Like the process for picking the cards, I tried to approach coding this process from the point of view of a person playing the game. For example, if I know that a card works really well with my hand (high affinity) then I’ll bid a lot higher than I normally would.  That was the very first step in the bidding process - the higher affinity, the higher the bid.

If I’m playing against more players, I’ll also tend to bid a bit more. Thus, the more players on the board the higher the bid will be. However, each AI player has their own personality - a high bid for one player might be 40 or 50 chips, while for another player it might be 20 chips.

After this bit of coding,  I played many games against the AI players and while I found that they were generally decent players they were still a bit too predictable. Human players would not be as predictable. They might try sneak in a win by:

  • bidding really low on a half-decent hand.
  • skipping bidding on the first round and waiting  until the second or third round.
  • randomly picking a card and see what they can build.

So I went ahead and coded all those types of behaviors into the AI and even a couple more.

The final part in coding fittingly dealt with selecting the final card. While the AI managed to get 5 cards most of the time, there were still occasions where an AI player stopped at 4 cards.

After some testing, it turned out that some of the AI personalities were still a bit too rigid - if they went for a Flush, they only bid on cards that gave them a Flush, even if that meant Booching.  If I was playing the game, I would give up the Flush and just settle for a Pair if I was about to Booch.

In Part 2, I mentioned that the AI is aware of what Condition a new card will make its hand:

1. Royal Flushes are possible
2. Straight Flushes are possible.
3. Flushes are possible. Straights are not possible.
4. Straights are possible. Flushes are not possible.
5. Only pairs, trips, full houses, etc, are possible.

Most of the time, the AI selects cards that keep it in the same Condition so that the new card won’t spoil a good hand. However, a spoiled hand is better than a Booched hand.  So I added code directing the AI to allow itself to select cards of a much lower Condition if there are few cards remaining in the deck.  This also is dependent on the AI’s personality - a ‘few’ cards to one might be 5, to another it might be 15.  The AI will also increase its bid to avoid a booch.  How much it increases its bid depends on its personality as well.

So in summary, that pretty much covers how the AI in Auction Poker works. What surprised me the most was how many subjective adjustments and refinements I had to put in place. Before I began coding the AI, I thought it was going to be a matter of brute force calculations to find the best cards and bid on them. The calculations turned out to be just the very first step.

Leave a comment