C / C++ / C#

  1. Home
  2. Computing & Technology
  3. C / C++ / C#

Creating a Texas Holdem Poker Test Harness and Poker Bots

By David Bolton, About.com

Poker Table Design
The purpose of this project is to develop a Texas Holdem poker test harness that understands the rules and can run games of Poker between 2 and 8 players. It will include a simple plugin architecture based on dlls so that poker bots can be developed, as well as a visual interface that is used when a single human is playing. The intention is to have something that can help test computer players.

Once the player DLL architecture has been published, we may run a Programming Challenge for the best poker playing AIs but that depends on enough people declaring an interest in it, well at least a dozen.

The rules of Texas Holdem

The game is played for an agreed number of plays. At the start, an agreed amount is declared as the Ante- say 10 chips (representing dollars, units, cents, matches...) and periodically during the course of the game, after a pre-agreed number of plays this gets doubled.

Each player starts with the same amount of chips. A player is randomly chosen as dealer and the player to the left of the dealer is called the Small Blind, with the player to his left as the Big Blind. The Small Blind must pay half the Ante to play, the Big Blind plays the full amount.

The cards are now dealt two to each player face down known as hole or pocket cards. Starting with the player to the left of the Big Blind, each player must decide to fold or stay in. If they stay in then they must put in the full Ante amount and either check or raise. If they raise then this increases the amount needed by players to play. When it reaches the Small Blind he/she must call, i.e.pay the remainder (Half the Ante plus whatever extra has been raised) and any players who decide to stay in but are short of the raised amount must pay the remaining amount or fold. This period of play is called pre-flop.

Next one card is thrown away and three community cards placed face up in the centre. This is known as the flop. There follows one round of betting where players can fold, check, raise or match any raises. Next another card is thrown away and a fourth community card (the "Turn") placed face up followed by a round of betting. Finally a 5th card is discarded and the last community card (the "River") is dealt face up and a last round of betting follows.

The play finishes when only one player is left or after the river, following all betting and the cards are compared to see who had the best hand made from five cards out of the sevenn- 2 in their hand plus the 5 community cards.

Ranking

Cards are ranked Ace (high), King, Queen, Jack, Ten, Nine, Eight,Seven, Six, Five, Four, Three, Two, Ace (low)
  • Straight Flush - Cards have the same suit (Hearts, Clubs etc) in a sequence eg A-2-3-4-5.
  • Four of a Kind. One of Each suit.
  • Full House - A Pair and three of a kind
  • Flush - All cards are in the same suit.
  • Straight - Cards form an unbroken sequence eg 4-5-6-7-8 or 9-10-J-Q-K
  • Three of a Kind. Three cards with the same value.
  • Two Pairs.
  • One Pair.
  • High Card
So a hand with a Full House beats a Hand with a Flush etc.

Test Harness

This is an application that accepts game play instructions from human or bots after providing to those players the information they would be able to see. It must do the following.
  • Manage and deals cards to all players.
  • Play hands by cycling through players and accepting instructions.
  • Be able to score and compare best hands.
  • Tracks all wins and losses, played cards and manage chips.
  • Use a Common interface for Human and Computer players.
A Poker Player Bot needs to do the following

  • Access visible Information- bets, community cards, other players play.
  • Rate its hand preflop, post flop, turn and river.
  • Bet accordingly
The Test Harness, (which I've named Pocahontas because it sounds like Poker harness!) is two applications. One visual and one non-visual. The visual interface is for a human player to play against other bots and/or players- it shows what each player is doing, chips in front of them etc and runs at near normal speed. The non-visual interface can runs hundreds of poker games per second and is meant for testing computer bots.

Visual Poker Table

The picture shows a typical poker table, not unlike those seen in online poker. There are 8 positions with the dealer marked with a small D, SB for Small Blind and BB for Big Blind. The blue text shows what each player has done, with player 5 pondering his/her play. Yellow text is the individuals chip count with the pot chips in the table. This is clearly during the betting round after the flop as there are three community cards on the table.

Player Bot Interface

This has to be defined and will be updated as the applications are developed.

Downloads

No Files yet.

Explore C / C++ / C#

About.com Special Features

C / C++ / C#

  1. Home
  2. Computing & Technology
  3. C / C++ / C#
  4. Projects
  5. Poker Harness
  6. Pocohontas - A Project to Create a Texas Holdem Poker Test Harness and Poker Bots

©2009 About.com, a part of The New York Times Company.

All rights reserved.