# Texas Hold-Em AI

This topic is 3819 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I've just finished a poker game it went fairly well. I am wanting to now write a Texas Hold-Em game where the player can choose 1-4 opponents(computer). I was wondering if anyone had some tips for the AI part of this game figuring out the opponents hand should not be a problem, but making them "think" about what they and whether to raise/bid/fold leaves some to be desired. I thought about googling texas hold-em winning odds, and trying to base some of the AI off that. But any other suggestions are welcome. Thanks

##### Share on other sites
I wrote up a proposal on this for a company a few years back.

There is a chart out there where some researchers ran millions of hands of TH'em and calculated the base winning odds of the first two cards. Obviously you have a 13x13 grid x2 for suited or unsuited. You should use that as your starting spot so the AI can decide whether to bother staying in after the first deal or not. For example, if he is dealt a 2,9 unsuited, he needs to bail.

After that, you may want to dip into some Bayesian math so each player can hold a belief about what the player is holding and how to deal with it. Even just having a continual indicator of whether or not you think the player's hand is strong or weak based on what's on the board and how the player acts will give you a start.

Anyway, if you want to do it right (i.e. realistic AI), Texas Hold'em... or any type of poker... is a bitch.

##### Share on other sites
/Me googles Bayesian math

O.K. this is going to be way out of my league, my math skills are not very good to begin with.

I think it would be simpler to make a multiplayer(real person) version heh.

Thanks

##### Share on other sites
Quote:
 Original post by loachman/Me googles Bayesian mathO.K. this is going to be way out of my league, my math skills are not very good to begin with.I think it would be simpler to make a multiplayer(real person) version heh.Thanks
Don't give up so easily. Use a simple AI to start with, and then you can do some research and keep replacing your AI with better versions.

##### Share on other sites
Thanks for the encouragement, will do.

##### Share on other sites
this is really odd, because my friends and I just started playing poker and I just started thinking about writing an AI for it. I have a few ideas, but it seems like it will be non trivial. Right now im just writing little calculators, for instance a rational betting checker, which will tell me what the likelihood of someones bets are based off their cards vs bluffing. but again there is not reason they cannot "bluff the bluff."

I will posit this. If you know how the poker program works, then their is probably a way to gain an advantage from it.

##### Share on other sites
Interesting FunkyMunky will def look into it more.

Ibebrett that would be great.

Thanks

##### Share on other sites
If you want it very simple, you can just have each player count the number of "out" to make a good hand and generate pot odds which forms the basis of further betting. If a player has a 20% odds of making his hand (i.e. 1 in 5), any betting where he stands to win more then than, he will play.

Confusing? Probably but use this link :) http://www.flopturnriver.com/start_pot_odds.html

-Sturla

##### Share on other sites
I'm a bit crazy over the stuff and it might be a lot more complicated than what you need here, but why not write a neural network to learn when to fold and when to play?

It is a perfect place to use them.

Inputs would be the cards dealt, the bets the other player makes, the cards on that are being shown, what the other player's cards end up being. Outputs would be how much to bet and if it should play. The fitness on this one is easy, how much did it lose or how much did it win.

Have the computer play itself for a few days and you'll have a super smart poker player.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 12
• 11
• 15
• 11
• 11
• ### Forum Statistics

• Total Topics
634149
• Total Posts
3015835
×