Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    149
  • comments
    510
  • views
    94918

Return of Agent Shark

Sign in to follow this  
noaktree

247 views

I'm moving on with my Poker AI experiment. My initial entry can be found here if you'd like to catch up. It's been a while since I've looked at this code so this entry will mostly be to help me refresh and get some direction. As I've said, a poker hand is made of 4 16 bit words. Each 16 bit word represents the potential cards in a suit. This uses 13 of the 16 bits. Hand types are seen below:

0 = High Card
1 = Pair
2 = Two Pair
3 = Set
4 = Straight
5 = Flush
6 = Full House
7 = Quads
8 = Straight Flush

I've created a function to calculate a 32 bit comparable value called the hand value. A straight flush looks like 0x00890000 in hex. Where 8 is the hand type and the rank(9) = Jack high. So we have a Jack high straight flush, not bad. The remaining ranks are not needed in this particular value as any Jack high straight flush will equate with another, thus a chopped pot.

The next step according to West (Game Developer Nov,2005) is to calculate the hand strength, a percentage value of winning, using the following algorithm:
  • Create a pack of cards
  • Set score to 0
  • Remove the known cards (community and hole cards)
  • Loop a few thousand times
    • Shuffle the remaining deck
    • Deal opponent's hole cards and the remaining community cards
    • Evaluate all hands (using hand values) and see who has the best hand
    • If agent has best hand
      • Increment score by 1/number of people with same value
  • Hand Strength = score/number of loops
So this is my next step. I'm thinking that other useful data could be found using this function as well. For instance we could track the number of times we make a particular hand type and form useful probability scores from this.

I'm trying to stay motivated on gamedev. It has always been a rewarding part of my life and I'd like to keep it. I'll be forcing myself to make posts, even if it's just to say blah, in an effort to keep on truckn.

It would be useful if the gamedev journals allowed categories.
Sign in to follow this  


1 Comment


Recommended Comments

You definitely should keep on truckin [grin]

Could be very interesting to add some sort of graphing/statistical reporting tool to run alongside your Poker program. Even if just as a learning tool it could be interesting to see inside the "mind" of a "perfect" player - especially graphed over time or whatnot..

Jack

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!