Saturday, 27 April 2013

A real life project: The business of Texas Hold 'em

I'm still in the preparation stage but I want to backtrack and come at the problem from a different point of view, the business. In this case the business is a poker game, to be more precise Texas hold 'em. I think I'm lucky here because I have some experience with the game so I (helped by some internet searching) can act as the source of the business knowledge.

This post may read more like a rough guide to Texas hold 'em, but knowing the business is extremely important when developing software. The finished code should contain the terms that I use here and should model the processes I describe.

Let's start by agreeing some basic terms for the game. There's a lot more terms in Texas Hold 'em than I mention here, but I'm limiting it to the terms that I will use in the game.



Game - starts with the dealing of hands to players, and finishes when one player wins the hand.
Tournament - a series of games.


  • Round of betting - This is when the players can bet, check or raise. It occurs after the private cards, flop, river and turn.
  • Cash - money held by each player for the purpose of betting.
  • Blinds - forced bets by the first and second players left of the dealer. First to the left plays the small blind and the second plays the big blind.
  • Pot - all the cash that has been bet.
  • Check - player indicates that they do not wish to bet and the turn moves to the next player
  • Bet - player puts money into the pot
  • Call - player puts enough into the pot to stay in the game
  • Raise - player puts more than enough into the pot.
  • Fold - when a player quits the game.


  • Button - aka the "dealer button", that shows the position of the dealer on the table. This moves one position to the left with each game.
  • Private cards - each player gets two cards that are for their eyes only.
  • Hand - these are the best cards that a player using for the game. A hand is made up of 5 cards selected from the private cards that the player holds and the community cards.
  • Community cards - the cards that are dealt face up. Players use three and sometimes four or five of these cards to make up their hand.
  • Flop - when the first three community cards are dealt.
  • Turn - the fourth community.
  • River - fifth and final community card.

Hands in order of strength (low to high)

Outside of the basic terminology, knowing the ranking order of the hands is really important. 
  • High Card - nothing of value in the hand so the highest card is used. Cards are ranked in the order 2 - Ace.
  • One Pair - two cards of the same value.
  • Two Pair - same as above, but twice.
  • Three of a Kind - three cards of the same value.
  • Straight - five consecutive cards of any suit.
  • Flush - five cards of the same suit.
  • Full House - A hand consisting of 3-of-a-kind and a (different) pair.
  • Four of a kind - four cards of the same value.
  • Straight flush - five consecutive cards that all have the same suit.
  • Royal Flush - 10, Jack, Queen, King, Ace of the same suit.

Playing a game

The easiest way to understand something is by doing it, so let's run through a game. For this game we'll have four players sitting in order from left to right, Holly, Mike, Ann and Dave.

Before any cards are dealt

The button is in front of Holly so she's in the dealer position. That doesn't mean that she will actually deal, that will be handled by the game. This only gives a way to keep track off the order.

Before any cards are handed out the blinds must be paid. Mike is to Holly's left and then Ann so Mike pays the small blind of 10 and Ann pays the big blind of 20. Two cards are dealt to each player starting with Mike and ending with Holly.

First round of betting

Dave must act first because he is the first player after the big blind. Checking isn't an option for Dave because of the blinds so he has three options. He can a) Call by matching the big blind, b) Raise by putting in more than the big blind or c) Fold and leave the game. Dave decides to fold and the play moves to Holly.

Holly has the same choices as Dave and she decides to call by matching the big blind with 20 and moving the play onto Mike. Mike also wants to call and seeing as he put in the small blind he puts in just 10 more to bring his contribution to the pot up to 20. This round of betting ends with 60 in the pot.

The Flop

The game moves on by dealing the flop, AH, KH, 7C. Play moves again to the player left of the button, Mike. Mike choices are to a) Check, or b) Bet. Folding is also an option but this would not be wise because he can stay in the game for free by checking. Mike checks, Ann checks and that leaves Holly with the decision of betting or checking. Holly bets 100 which forces the others to either fold or pay 100 to stay in the game. Mike is first and he calls Holly by putting in 100. Ann folds and she is out of the game.

We now have a pot of 260 and community cards AH, KH, 7C.

The Turn

With that round of betting over the Turn card is dealt and its AD. Betting again is to Holly's left and that's Mike. This time Mike bets 100 and it's back to Holly. Holly calls Mikes 100 and raises another 100. The betting goes around again because of Holly's raise and Mike calls Holly's bet by putting in another 100.

We now have a pot of 660 and community cards AH, KH, 7C, AD.

The River

The last card is dealt and it's the 8C. This moves us into the final round of betting, starting again with Mike. Mike checks and leaves the decision to bet with Holly. Holly bets 200 and Mike calls the 200.

No more betting can take place and there are no more cards to be dealt so the players turn over their cards to see who has won.

Holly turns over AC, KC. Mike turns over AS, 10S.

With the community cards AH, KH, 7C, AD, 8C the players make the best hands they can. Holly can make a full house of aces and kings (AH, AD, AC, KH, KC). This beats Mikes best hand of triple aces (AH, AD, AS, KH, 7S).

Holly wins the pot of 1060 with a full house.

There you have it, that should be a good enough overview of the business side of things. I know that this post  may seem to have little to do with software development but trying to build a system without this knowledge will lead to failure. It also leads us nicely onto the next section, which is to take this business knowledge and start breaking it down into pieces of behaviour.

No comments:

Post a Comment