Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Internet Gambling > Software
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #31  
Old 12-24-2006, 07:47 PM
bachfan bachfan is offline
Senior Member
 
Join Date: Nov 2005
Posts: 196
Default Re: 7 Card Hand Evaluators

[ QUOTE ]
Pretend we have two players that play only two hands:

AK or AA.

First player: AK - 16 combos, AA 6 combos, total 22
First Players chance of playing AK is 16/22
First Players chance of playing AA is 6/22

Now assign the second player:

If player 1 was assigned AK (p = 16/22), then
Player 2: (Baysian updating)
Plays AK with 9/12 probability
Plays AA with 3/12 probability
If player 1 was assigned AA (p = 6/22), then
Player 2: (Baysian updating)
Plays AK with 8/9 probability
Plays AA with 1/9 probability

Now what is Player 2's chance of playing AA
(16/22)*(3/12) + (6/22)*(1/9) = 7/33

Now the problem: Player 1 and Player 2 had the same distributions. But 7/33 != 6/22. The problem is that assigning PLAYER 1 his distribution frist, gives player 2 an unequal chance of getting AA. The player most likely to be dealt pocket pairs, is the one where all the aces are in deck when he gets a card on his distribution.

A correct algorithm, would at the very least, have to give both players (with equal distributions) an equal chance of getting AA. Thus, dealing everyone random hands, and discarding until everyone gets a hand on their distribution is an unbiased, but albeit extremely slow method of getting the right answer.

[/ QUOTE ]

You are correct. If only you had written this earlier it would have saved me a few days of thought/work two years ago. [img]/images/graemlins/smile.gif[/img]

I came up with a (relatively) fast way to generate random razz hands, but could not prove it was correct. So I in fact implemented the extremely boneheaded (but unambiguosly correct) algorithm you outlined above for comparison purposes. Took billions of hands to converge within 0.01% in some cases, but converge they did.

- bachfan
Reply With Quote
  #32  
Old 12-24-2006, 07:49 PM
_D&L_ _D&L_ is offline
Senior Member
 
Join Date: May 2006
Posts: 128
Default Re: 7 Card Hand Evaluators

yeah, took me longer than 2 days to figure out why player 1 kept beating player 2 through 10, when i assigned them all the same distributions [img]/images/graemlins/smile.gif[/img]
Reply With Quote
  #33  
Old 12-24-2006, 09:50 PM
Phil153 Phil153 is offline
Senior Member
 
Join Date: Oct 2005
Posts: 4,905
Default Re: 7 Card Hand Evaluators

[ QUOTE ]
[ QUOTE ]
Phil why are you hostile? Did I ever say the world needed a poker stove that was 10,000 times faster? In fact, you gloss over the fact I said the exact opposite, because you want to pick a fight.

[/ QUOTE ]
Phil153 + Idiots = Flames

Juk [img]/images/graemlins/smile.gif[/img]

[/ QUOTE ]
FYP.

BTW, hand evaulation algorithms are not poker AI.
Reply With Quote
  #34  
Old 12-25-2006, 10:38 PM
Gullanian Gullanian is offline
Senior Member
 
Join Date: Dec 2006
Posts: 1,748
Default Re: 7 Card Hand Evaluators

Please could you all run this test on your hand evaluators and let me know the results:

int c1, c2, c3, c4, c5, c6, c7;
int handSetCounters[8] = {0,0,0,0,0,0,0,0};

for(c1 = 0; c1 < 52; c1++) {
for(c2 = c1 + 1; c2 < 52; c2++) {
for(c3 = c2 + 1; c3 < 52; c3++) {
for(c4 = c3 + 1; c4 < 52; c4++) {
for(c5 = c4 + 1; c5 < 52; c5++) {
for(c6 = c5 + 1; c6 < 52; c6++) {
for(c7 = c6 + 1; c7 < 52; c7++) {

CALCULATE RANK
CALCULATE SET ID (HIGH CARD TO STRAIGHT FLUSH)
INCREMENT HANDSETCOUNTERS[SET ID]

}}}}}}}

PRINT HANDSETCOUNTERS


If you could time the speed of your code in that scenario it would be most interesting! Also with a copy of your results (number of flushes etc incase your code is not designed to be 100% accurate).

Thanks for anyone that participates!

Tom
Reply With Quote
  #35  
Old 12-26-2006, 12:51 AM
_D&L_ _D&L_ is offline
Senior Member
 
Join Date: May 2006
Posts: 128
Default Re: 7 Card Hand Evaluators

I've done the tests. It took some rewriting of my code to make your tests work, and i haven't yet checked them for accuracy.

Without the checksums i was getting 117,354,877 games per second. It took 1.14 seconds to process all 133,784,560 games in the loops.

With the check sums, which i didn't spend time optimizing it took 1.71 seconds, for a speed of 78,236,584 games per second.

The result of the check sums are as follows:
In order from lowest hand to highest (hi-card, 1 pair, 2 pair, 3 kind, straight, flush, full house, four kind, to straight flush).

23294460
58627800
31433400
6461620
6180020
4047644
3473184
224848
41584

Let me know if you see errors in the checksum. I actually had to look at code that is no longer in my program to interpret my lookup tables, cause all my program knows now is that higher integer > better cards. I wrote a compression algorithm to make all the rankings fit on one integer, and had to decompress the results for your test, so its possible i could have made a mistake. Its also why the checksums almost double the time it takes for my program to resolve values.

P.s. i know 117 million is faster than the 60 million i said earlier. My program is designed to do a lot more than just resolve hand values. I took out some of the overhead, for this test.
Reply With Quote
  #36  
Old 12-26-2006, 01:47 AM
Phil153 Phil153 is offline
Senior Member
 
Join Date: Oct 2005
Posts: 4,905
Default Re: 7 Card Hand Evaluators

With these speeds you obviously have all your precalculated results in a single (very large) table, and nothing is calculated. The time for your algorithm is basically the time to increment the 7 counters(c1..c7), do one bitwise operation, look up the value in a a humongous table, and add the results.

This is incredibly simple to code if you don't mind a 200MB file on your hard file. It's actually easier to code than a 15 million hand/second algorithm, and far easier to code than an advanced and complex algorithm like PokerStove. If you used the same massive table in PokerStove, it'd probably run 5x faster than your code.
Reply With Quote
  #37  
Old 12-26-2006, 01:53 AM
_D&L_ _D&L_ is offline
Senior Member
 
Join Date: May 2006
Posts: 128
Default Re: 7 Card Hand Evaluators

Phil - do i have lookup tables yes. The same way you have a calculator to look up multiplication, while you perform calculus. But you'd be kidding yourself if you think you could put all the results in one look up table. As I've already said such a table would be several Gigs in size - and extremely slow if you used a hardrive. Mine is 15 MB.

If you think i'm just pushing 7 counters, i'd be resolving about 6 to 9 billion games a second. Why is it you assume I'm only capable of coding a simple algorithms. My programming skills may be sub-par, but i've spent years studying game theory - so why is it u assume my algorithms "must" be simple? More specifically, why do you respond to everything with "BS" "idiot" an the like, is the fact the someone else can code something like this a "threat" to you?
Reply With Quote
  #38  
Old 12-26-2006, 08:13 AM
A.Nironen A.Nironen is offline
Senior Member
 
Join Date: Oct 2006
Posts: 118
Default Re: 7 Card Hand Evaluators

[ QUOTE ]

If you could time the speed of your code in that scenario it would be most interesting! Also with a copy of your results (number of flushes etc incase your code is not designed to be 100% accurate).


[/ QUOTE ]

Gullanian,

Here is my demo (210 Kb).

http://www.pokerbolide.com/files/handeval7cards.exe

Andrzej Nironen
Reply With Quote
  #39  
Old 12-26-2006, 01:58 PM
Gullanian Gullanian is offline
Senior Member
 
Join Date: Dec 2006
Posts: 1,748
Default Re: 7 Card Hand Evaluators

D&L, congratulations, your numbers are correct and I am very impressed.

PokerBolide.com, wow. I am amazed. I thought I had the optimum solution, but you have out done me and months of work, im truly impressed.

Congratulations both of you, I don't know how you do it but they seem to work superbly.
Reply With Quote
  #40  
Old 12-26-2006, 02:05 PM
Gullanian Gullanian is offline
Senior Member
 
Join Date: Dec 2006
Posts: 1,748
Default Re: 7 Card Hand Evaluators

PokerBolide.com, wow, just running again and it's superb. My solution used look up tables, some faily large in size, and yours does not seem to at all. Superb.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:49 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.