login about faq

What is the best approach to detect all possible draws of the current Holecards in combination with the current Flop/Turn/River ?

Programming Language doesn't matter..

asked Aug 07 '10 at 00:04

jack's gravatar image

jack
11111

Best in what sense, and what do you count as a draw? Do you include ways that you might counterfeit or tie an opponent?

(Aug 07 '10 at 21:35) Douglas Zare

primarily im thinking of flush and straightdraws.

to detect a flushdraw shouldnt be a problem at all, but my thinking is focused on the straight-draws atm...

(Aug 08 '10 at 10:04) jack

For each possible straight, see whether the hold card ranks union the board ranks occupy 4/5, or 3/5 for backdoor draws.

(Aug 11 '10 at 15:55) Douglas Zare

I agree with Douglas Zare, I'm just answering to get this question marked as answered. When I was writing a poker evaluator my research indicated that bitwise operations where the fastest. For example: I represented any set of poker cards as a 64 bit unsigned integer for instance : 1111000000000000000000000000000000000000000000000010000000000000 represents the poker hand 2h, 2d, 2c,2s, As. The last 12 bits are not used because there are only 52 cards in a deck. To check for each of the 10 possible straights I used bitwise ANDS. For instance to detect 2,3,4,5,6 I had a function that used bitwise AND tests to count if the hand had a 2, then a 3, etc.

2 = 1111000000000000000000000000000000000000000000000000000000000000,

3 = 0000111100000000000000000000000000000000000000000000000000000000,

etc.

if you counted 5 hits you had a straight, if you have 4 hits you had a 1 card straight draw.

In practice:

i needed code to sort out what to report when I found multiple straight draws.

I had to check for stronger hands than straights first.

You can write better bitwise code. This is just roughly how I happened to do it.

At the time I found Cactus Kev's website was helpful:

http://www.suffecool.net/poker/evaluator.html

You could also just use someone elses hand evaluator, for instance: http://www.codeproject.com/KB/game/pokerhandevaldoc.aspx

link

answered Aug 15 '10 at 07:48

mazoula%201's gravatar image

mazoula 1
7114

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×35

Asked: Aug 07 '10 at 00:04

Seen: 316 times

Last updated: Oct 10 '10 at 10:22

powered by OSQA