Basic Poker AI

The hand ranking is defined by a hand rank value, plus the highest card value. The hand rank values are for a royal flush 180, a straight flush is 160, four of a kind is 140, a full house is 120, a flush is 100, a straight is 80, three of a kind is 60, two pair is 40, a pair is 20, and a high card is 0.

All players are categorized as “conservative” or “not conservative” and “strong,” “average,” and “weak.”

The AI to Determine the Best Poker Hand Using Five to Seven Cards

  1. Flush—check to see if at least five cards are in the same suit.

  2. Straight—put cards in ascending order and check if there are five consecutive cards. (Reminder: Place the ace in the lowest and highest positions.)

  3. If flush and straight came out positive, we have a straight flush; check for ace high for royal flush.

  4. If we have found a straight or a flush hand, set its value and return.

  5. If nothing found so far, put the cards in rank order.

  6. Check each rank from the ace (high) to the deuce (two, low card).

  7. If one rank has four cards found, we have four of a kind; set its value and return.

  8. If one rank has three cards found, we have at least found the highest three of a kind hand (set value to trip.) Remember we could be examining seven cards.

    If another rank has at least two cards found, we have a full house (set value to a full house).

    On three cards of same rank found, set value to trip or full house and return.

  9. If one rank has a pair (two of the same rank), then we have at least found the highest pair (set value to a pair).

    If another rank has a pair, then we have a two pair hand (set value to two pair).

    On a pair found, value a two pair or pair value and return.

  10. We have only a high card, so set the value to the highest card and return.

Draw Poker (No Openers and Jacks or Better)

All analysis assumes an eight-player game, and the logic works for any amount of players.

  1. For strong players, don’t open betting in position one through four without a pair of aces or two pair with queens or better.

A pair of kings can open in positions five and six, while position seven can open with a pair of queens or jacks with ace kicker. The dealer who goes last needs a pair of jacks or better to open betting.

  1. In a high ante game, position one through three needs a pair of kings, position four through six needs a pair of queens, and the remaining positions need a pair of jacks to open betting.

  2. Against strong players, don’t “call” with less than two pair headed by at least a king. In last positions, seven or dealer, you can call with two pair.

  3. Against weak to average players, you can “raise” with a pair of aces or kings if you are alone with the opener and last in position.

  4. Don’t “raise” with opened straights or four flush cards, and only call if the pot yields four times your bet.

  5. “Raise” with trips (three of a kind) that are ten and below. “Call” with jacks or better before the draw to force players out or keep them in for the kill with the higher hands. Against strong players, you need strong cards to raise when they open. Against weak players (i.e., players who open with jacks or queens under the gun), you can raise aggressively when holding aces or kings.

    Any player who checks during the first bet round can only call bets thereafter in the first round.

In Draw Poker Jacks or Better, the computer will check each hand to see if the hand passes the Jacks or Better test. If no player has this requirement, each player must “check” and the hand is redealt (the ante up will increase). If the player folds or tries to “open” and the requirement has not been met by any player, the computer assumes a “check.” If the player (non NPC), has a pair of kings and “checks” and no other player has met the requirements, a new hand is dealt (the computer must not force the player to make an opening bet). In Draw Poker, a minimum starting bet or “ante” is made by each player before the first card is dealt. All cards are dealt face down, starting with the player to the left of the dealer. A player may discard up to three cards or four cards if they hold an ace (computer checks this situation) and receive replacement cards. Discarded cards are immediately reshuffled into the remaining deck after that player has received cards so that a player will never get his discarded cards back. If a player opens by betting or raises a bet, he cannot raise again, unless another player has raised. In all poker games, a maximum of three raises is allowed per betting session.

Five Card Stud

  1. If hand value is a royal flush, straight flush, or four of a kind, “bet” or “raise” the maximum amount and return.

  2. If hand value is a full house, flush, straight, or three of a kind (trip), “bet” or “raise” medium.

  3. If the hand value is only a high card and seeing the others up cards shows that you have the highest single card (no one has a pair or better showing)...

    • If asked to “check,” then check.

    • If you are to bet first and if it’s the first round of betting and you have an ace (conservative) or a ten (nonconservative), “bet” medium.

    • If after betting round one you have the highest card of at least a queen, “bet” medium (conservative) or maximum (nonconservative).

    • If you are not the first bettor (a bet has been made) and you have an ace (conservative) or a queen (nonconservative), “bet” maximum.

    • Otherwise, “call.”

    If a raise has been made, conservative players always “fold.”

    • Strong players “call” on betting round one and afterward; if they have the highest card showing or better, they “call;” otherwise, they “fold.”

  4. If you have no pair and not the highest hand showing and you are the first bettor...

    Conservative “folds.”

    Nonconservative...

    • If betting round is three, then “fold.”

    • If betting round is one or two, then...

      • With ace “bet” maximum.

      • With a queen or king “bet” medium.

    • Otherwise, “check.”

  5. If you have any pair on the opening bet round (first two cards) or any round a hand better than three of a kind...

    If the highest hand showing is better than your hand, on the last betting round “fold.”

    If first to “bet” and pair is...

    • Less than a pair of queens, “check.”

    • A pair of aces, “bet” maximum.

    • A pair of kings or queens, “bet” medium.

    • Two pair (remember the first pair may signal this code, so check to see if there’s a two pair hand) then “bet” maximum.

    Another player has bet and you have (a pair or better)...

    • A pair of aces or a better than a pair hand, then “bet” maximum.

    • Otherwise “check.”

    Another player has raised and your pair is...

    • Less than the highest hand showing and you are a strong player...

    • With queens or better then “call.”

    • Otherwise, “fold.”

  6. If you have a full house or better and raises made are less than three, then “raise” maximum.

    Otherwise, “call.”

Seven Card Stud, Chicago Lo, and Chicago High

Special Case for Chicago High

One of your first two cards is a spade.

  • You have the ace of spades; therefore you can’t lose, so “bet” maximum.

  • You have the highest spade since any higher ones are shown, so “bet” maximum.

  • You have the king of spades, so “bet” medium.

  • You have the next highest spade since any next higher ones are shown, so “bet” medium.

  • If the spade you have is within three ranks of the highest spade not showing then...

    • If no raises, then “call.”

    • If raise was made, then “check.”

  • If you are to bet and...

    • If the spade you have is within four ranks of the highest spade not showing, then “bet” minimum.

    • If the spade you have is within nine ranks of the highest spade not showing, then “check.”

Otherwise, follow steps one through six.

Special case for Chicago Lo

  • One of your first two cards is a spade.

    • You have the ace of spades; therefore you can’t lose, so “bet” maximum.

    • You have the lowest spade since any lower ones are shown, so “bet” maximum.

  • You have the two (deuce) of spades, so “bet” medium.

  • You have the next lowest spade since any next lower ones are shown, so “bet” medium.

  • If the spade you have is within three ranks of the lowest spade not showing then...

    • If no raises, then “call”

    • If raise was made, then “check.”

  • If you are to bet and...

    • If the spade you have is within four ranks of the lowest spade not showing, then “bet” minimum.

  • Otherwise, follow steps one through six.

  1. Hand value is better than three of a kind.

    Your hand beats any hand showing.

    • You are the first to bet, “bet” medium.

    • Another player is the first to bet...

      • Round of betting is...

      • Conservative: Round one through three and then “check.”

      •          Rounds four through six and then “bet” maximum.

    • Nonconservative: Round one and then “check.”

      •  After round one, “bet” maximum.

    Your hand is not better than anything showing...

    • Stay with it until the last (seventh) card and “call.”

    • If a raise is on the table, don’t stay with a loser (“fold”).

  2. Hand value is at least a high pair.

    If hand is better than a pair or a pair of queens or better for conservative or eights or better for nonconservative, then...

    • Your hand is better than anything showing...

      • You are the first to bet, so “bet” maximum.

      • You are not the first to bet, so “raise” maximum.

    • Your hand is not the highest (a better one is showing)...

      • You are the first to bet, so “check.”

      • “Call” bets until the fourth card is dealt and “fold” if no improvement.

      • A “raise” is on the table; don’t stay with a loser.

    On the last card, your hand has not improved, so “fold.”

  3. Hand is at least a medium pair, which is a ten or higher for a conservative player and a six or higher for a nonconservative player.

    Your hand is better than anything showing...

    You have a king or an ace in hand with the pair...

    • Betting rounds one to six...

      • You are the first to bet...

        • Betting rounds one to five and then “bet” medium.

        • Betting round six and then “check.”

      • You are not the first to bet...

        • Betting round six and then “call.”

        • Otherwise, “raise” maximum (if you can).

    • Last betting round (sixth)...

      • You are the first to bet so “check.”

      • Otherwise, “fold.”

    • Your hand is not the highest (a better one is showing)...

      • You are the first to bet so “check.”

      • “Call” bets until the fourth card is dealt, and then “fold” if no improvement.

  4. Hand is at least a low pair.

    Your hand is better than anything showing...

    • Betting rounds...

      • One and two for conservative and one through four for nonconservative...

        • Your hand is highest one showing...

          • You are the first to bet so “bet” medium.

          • You are not the first to bet...

            • No player has raised so “raise” medium.

            • Otherwise, “call.”

    • Your hand is not the highest one showing...

      • You are the first to bet so “check.”

      • A bet has been made by another player...

        • Betting round two for conservative or betting round four for nonconservative, and then “fold.”

        • Otherwise, “call.”

      • Three to six for conservative and five to six for nonconservative...

        • You are the first to bet so “check.”

        • Your hand is the highest one showing so “call.”

        • Your hand is not the highest one showing...

          • Betting round six and then “fold.”

          • Betting round six...

          • If lucky, then “call.”

          • If unlucky, then “fold.”

        • Other betting rounds...

          • If no raises yet, then “check.”

          • If raise, then “fold.”

    Your hand is not better than anything showing...

    • Betting round six or conservative and then “fold.”

    • Otherwise...

      • If lucky, then “call.”

      • If unlucky, then “fold.”

  5. Hand possibly a flush or a straight....

    If your cards are of the same suit or rank within straight range....

    • First bet round...

      • You are first to bet, so “check.”

      • You are not first to bet, so “call.”

    • Second bet round...

      • You are first to bet, so “bet” medium.

      • You are not first to bet, so “call.”

    • Five and six betting rounds...

      • If fifth betting round...

        • King or better in hand...

          • You are first to bet so “check.”

          • Otherwise, “call.”

      • If sixth betting round...

        • You are first to bet, so “check.”

        • You are not first to bet...

          • Flush or straight and then “call.”

          • Otherwise, “fold.”

    Three and four betting rounds...

    • You are first to bet so “check.”

    • You are not first to bet so “call.”

  6. If there’s a raise and you have nothing in steps one through five, then “fold.”

Texas Hold ’Em and Omaha

  1. The player to the left of the dealer is forced to make a “blind bet” (“bet” minimum).

  2. Determine if you should stay with the first two cards (for Texas Hold ’Em) or first four cards (for Omaha) in your hand.

    You have a pair (remember in Texas Hold ’Em you can use one, two, or none of your first two cards and in Omaha you must use two cards of your first four cards.

    • If your pair for conservative is aces or for nonconservative is tens or better, then “bet” or “raise” maximum.

    • If your pair for conservative is queens or kings for nonconservative is sixes or better, then “bet” or “raise” medium.

    • If you have any pair, then bet “minimum.”

    • Otherwise, “call” or “check.”

  3. For all remaining betting rounds, get the value of your hand.

    Your hand is only a high card...

    • You are the first to bet so “check.”

    • You are not the first to bet...

      • Conservative players “fold.”

      • Nonconservative player “call” for the second and third betting rounds and “fold” after the last “community card” is turned over.

    Your hand is a pair...

    • You are the first to bet so “check.”

    • You are not the first to bet...

      • A player has raised then...

        • If you have won the last two hands, then “call.”

        • Conservative players “fold.”

        • Nonconservative player “call” for the second and third betting rounds and “fold” after the last “community card” is turned over.

      • A player has bet...

        • For the second and third betting rounds so “call.”

        • “Fold” after the last “community card” is turned over.

      • Players so far have checked and then you “check.”

    Your hand is two pair...

    • You are the first to bet...

      • Conservative players “check.”

      • Nonconservative players “bet” medium.

    • You are not the first to bet...

      • No one has raised so “call.”

      • A raise has been made...

        • You are in the first three players from the dealer so “fold.”

        • Otherwise, “call.”

      • Only a call so far, so you then “call.”

    Your hand is three of a kind (a trip) or better...

    • You are the first to bet so “bet” maximum.

    • You are not the first to bet...

      • Your hand is a straight or better so “raise” maximum.

      • There are no raises yet, so “raise” maximum.

    • Another player has raised...

      • You are in the first three players from the dealer so “call.”

      • You are the fourth player from the dealer so “raise” medium.

      • You are more than four players from the dealer so “raise” maximum.



Game Design Foundations
Game Design Foundations (Wordware Game and Graphics Library)
ISBN: 1556229739
EAN: 2147483647
Year: 2003
Pages: 179

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net