View Single Post
  #6  
Old 11-15-2007, 07:35 PM
Paragon Paragon is offline
Senior Member
 
Join Date: Sep 2004
Location: Maryland
Posts: 212
Default Re: Programming a Poker Game

All of the comments are pretty good. As for representing a hand, you can use 4 integers to neatly do this. Each integer represents one of the four suits, and the bits of the integer determine if a particular card of that suit is in that player's hand. Now you can do some neat bit tricks to quickly figure out the hand strength... Like if there are 5 one's in the spade integer, you know the hand is at least a flush. Or if you bitwise AND the four integers together into one integer, and that still has a single bit set, then you know you have quads. Anyway, all of this is in the eval code of pokenum or whatever the open source project is, although they also use huge precomputed lookup tables for 5 card hands I think.
Reply With Quote