About the Poker AI

Heads Up Poker Apps use a custom made Artificial Intelligence (AI). Since it is only playing against one person (you) and not trying to simulate a table full of other characters, we've been able to optomize it to play well, and try and take your chips as best it can.


Does the AI player cheat or peek at the cards?

NO! ABSOLUTELY NOT!
That wouldn't be any fun from either a playing or programming standpoint. It's been a lot of fun making a poker AI that is now quite a good player.
Also, since this is a "play-money" game, there is no incentive or benefit to cheating.


About the AI Personalities

They're all different. Some are more likely to bluff. Some play cautiously others reclessly. Different ones will bet bigger or smaller amounts. Some slow play a great hand more often. But you'll have to play and see which one does what!


How does the AI player work?

The computer runs many simulated hands based on the 'known' cards (its own cards plus board cards) to determine a baseline strength of his own hand. It then adjusts the baseline hand strength using many factors such as board texture, player aggression, and betting patterns. There is also a large degree of weighted randomization to make the AI player more difficult to 'read.' It knows how to buff, slow-play, continuation bet, protect its hand, recognize draw-heavy (scary) boards, recognize the player's betting tendencies, and more...

Each of the different personalities weights these differently to give a good variation in play styles.

'Beginner Bec' is the one exception. It started as a test opponent for the regular AI, and was included since it is good beginner play. It's so simple, the source code is included at the bottom of this page.


Sometimes the AI player makes horrible plays!

Don't we all? Failed bluff attempts can look very foolish. Over-valuing medium-strength hands can also look very foolish sometimes. Every poker player has done this, and computer players do it, too.


Beginner AI Code (Hold'em)

This is for the programmers and the curious.

//-------------------------------------------------------------------
//Returns -1 to fold, 0 to call, or # to raise/bet that amount.
//-------------------------------------------------------------------
- (NSInteger)actionIfBeginnerToCall:(NSInteger)toCall pot:(NSInteger)pot minRaise:(NSInteger)minRaise round:(NSInteger)round turn:(NSInteger)turn myStack:(NSInteger)myStack theirStack:(NSInteger)theirStack {
	float handStrengthPct = realHandStrengthPct;  //calculated when cards dealt.
	
	[self setChanceBetSmall:40 medium:30 big:20 huge:5];			

	//First actions preflop
	if (round==1 && turn<=2) {
		//Nearly out, just go all in always to end the game or double-up.
		if (myStack<bigBlind*3) return myStack;

		//Always bet if a pair or an ace.
		if ((h1%13)==(h2%13) || h1%13==0 || h2%13==0) {
			[self setChanceBetSmall:10 medium:30 big:40 huge:5];
			return [self betWithMinRaise:minRaise pot:pot myStack:myStack theirStack:theirStack];
		}
	}

	//Decent hand, raises 1/2 the time.
	if (handStrengthPct>0.70 && rand()%2==0) return [self betWithMinRaise:minRaise pot:pot myStack:myStack theirStack:theirStack];

	//Randomly call or raise, ignoring hand strength.
	if (rand()%20==0) return 0;
	if (rand()%20==0) return [self betWithMinRaise:minRaise pot:pot myStack:myStack theirStack:theirStack];

	//Call or fold depending on hand strength.
	if (toCall>0 && handStrengthPct>0.5) return 0;
	//Fold if not strong, but never fold the small blind
	if (toCall>smallBlind && handStrengthPct<0.5) return -1; 
	return 0;
}


Available in the iTunes App Store