Could the difference be due to precision errors?
Examples:
9-6 video poker:
His: 0.99543904
Mine: 0.995359875519285
976-9-6:
His: 1.000000
Mine: 0.999922148379832
"6/5" Jacks or Better
His: 0.949961
Mine: 0.949882112106347
If this is a precision error, which is more accurate? I'm guessing his, since 976-9-6 is exactly one in his method. Any suggestions on how to remedy the issue?
Thanks,
Chris Ellis
Quote: tringlomaneMy guess is you have a tiny evaluation error somewhere, which may be difficult to find. :( 976/9/6 JoB should be exactly 100%.
That's exactly what I was worried about. With such a tiny issue it's going to be really difficult to find. Thanks for your time, though.
Quote: ChrisEThat's exactly what I was worried about. With such a tiny issue it's going to be really difficult to find. Thanks for your time, though.
No problem. With such a small error, here could be one educated guess. Does A2345 suited evaluate to a straight flush?
http://pastebin.com/RXW0jAn4
I got a little chuckle imaging your browsing some forums while driving. Don't make yourself car sick!
Pick a representative hand of each rank and print out your evaluations for all 32 draws. Then compare against
http://www.vpgenius.com/video-poker/custom-video-poker-game.aspx
All 32 evaluations should match perfectly, not just the maximum one. I'd use the VPGenius version rather than the Wizard's (no offense, Mike) because it gives exact hand frequencies for all draw possibilities rather than only EVs. Your error is in there somewhere, and I'd bet that you'll find it by looking at those 9 hands.
for (int k = 0; k < 5; k++)
for (int l = k + 1; l < 5; l++)
for (int m = l + 1; m < 5; m++)
for (int n = m + 1; n < 5; n++)
fourHold5[HandIndex4(conHand[k], conHand, conHand[m], conHand[n])]++;
I doubt this is the problem, but if I were doing this, I think I would do:
for(int k = 0; k < 1; k++)
for(int l = k + 1; l < 2; l++)
for(int m = l + 1; m < 3; m++)
for(int n = m + 1; n < 4; n++)
...I heart Crystal Math.
I think the 29 should be a 30.
Sadly, the results are even further off, with 976 giving a result of 0.940741487243407. But every error needs to be caught before it comes up right... and if one is wrong in there I probably missed more too.
Quote: ChrisESadly, the results are even further off
I hate it when that happens. I went back and forth with my BJ analyzer. I got very close, but I'm still not quite there. At least, I think I'm close.
Quote: CrystalMathfor (int k = 0; k < 5; k++)
for (int l = k + 1; l < 5; l++)
for (int m = l + 1; m < 5; m++)
for (int n = m + 1; n < 5; n++)
fourHold5[HandIndex4(conHand[k], conHand, conHand[m], conHand[n])]++;
I doubt this is the problem, but if I were doing this, I think I would do:for(int k = 0; k < 1; k++)
for(int l = k + 1; l < 2; l++)
for(int m = l + 1; m < 3; m++)
for(int n = m + 1; n < 4; n++)
...
The more elegant approach (in my opinion) is to reverse the order and do this:for (int c5 = 4; c5 < 52; c5++) {
for (int c4 = 3; c4 < c5; c4++) {
for (int c3 = 2; c3 < c4; c3++) {
for (int c2 = 1; c2 < c3; c2++) {
for (int c1 = 0; c1 < c2; c1++) {
...
} } } } }
This is the approach used in the Wizard's video poker calculator.
Quote: JBQuote: CrystalMathfor (int k = 0; k < 5; k++)
for (int l = k + 1; l < 5; l++)
for (int m = l + 1; m < 5; m++)
for (int n = m + 1; n < 5; n++)
fourHold5[HandIndex4(conHand[k], conHand, conHand[m], conHand[n])]++;
I doubt this is the problem, but if I were doing this, I think I would do:for(int k = 0; k < 1; k++)
for(int l = k + 1; l < 2; l++)
for(int m = l + 1; m < 3; m++)
for(int n = m + 1; n < 4; n++)
...
The more elegant approach (in my opinion) is to reverse the order and do this:for (int c5 = 4; c5 < 52; c5++) {
for (int c4 = 3; c4 < c5; c4++) {
for (int c3 = 2; c3 < c4; c3++) {
for (int c2 = 1; c2 < c3; c2++) {
for (int c1 = 0; c1 < c2; c1++) {
...
} } } } }
This is the approach used in the Wizard's video poker calculator.
52 wouldn't be applicable in this section of code. This is part of getting all 32 ways to play a starting hand, specifically how to get 4 out of 5 cards.
Quote: CrystalMathCan you explain what convert_hand is supposed to do? To me, it looks like the results would always be 0.
I'm using the CactusKev method of hand ranking, and that's converting from that card-format to numbers from 0-51. I confirmed through a debug statement that all 52 cards convert properly.
Specifically, combin_array[0][1...5] and combin_array[1][2...5] should be 0, but they evaluate to 1.
This doesn't affect your hand indexing routine, but I use a different routine that is affected.
This is what I came out with for 976-9-6" Jacks or Better.
TOTAL: 19,958,334,252,030
Royal Flush: 438,645,936
Straight Flush: 1,772,710,452
Four of a Kind: 48,319,093,980
Full House: 153,251,132,940
Flush: 105,729,540,072
Straight: 148,596,266,250
Three of a Kind: 1,545,959,958,318
Two Pair: 2,711,125,745,874
High Pair: 4,359,131,748,360
Low Pair: 5,697,076,473,936
No Pair: 5,186,932,935,912
With how convoluted this code has become I'll probably have to start over from scratch and try again.
Thanks for all the help, it was greatly appreciated. I'll be using the advice here when I go back and try to tackle the problem again.
I can run the whole cycle for a pay table in about 2 seconds. You are doing something inefficient. Mike has written at length about how to write efficient VP analyzer code, you should read that.Quote: ChrisEHaha, that's true, but not what I meant! I mean I'm going to leave out the feature of letting you find the expected return for a paytable as a whole... and instead just have a single hand analyzer and "best play" trainer.
Quote: teliotI can run the whole cycle for a pay table in about 2 seconds. You are doing something inefficient. Mike has written at length about how to write efficient VP analyzer code, you should read that.
Yes, I've read it, and the VPGenius article he mentions and there's just some things that I'm missing. I was trying to get it working, then optimize it... but since it's not working I'm going to move on and come back to it later.
You don't need to optimize anything. It runs fast. Even poorly written code will execute a full cycle in under 5 seconds. I do not use nested for loops. I use one for loop that runs from 1 to 134459.Quote: ChrisEYes, I've read it, and the VPGenius article he mentions and there's just some things that I'm missing. I was trying to get it working, then optimize it... but since it's not working I'm going to move on and come back to it later.
Quote: teliotYou don't need to optimize anything. It runs fast. Even poorly written code will execute a full cycle in under 5 seconds. I do not use nested for loops. I use one for loop that runs from 1 to 134459.
I'm fairly certain my problem is somewhere in populating the arrays before you even get to the 134459 hands portion... but I really don't know.
I have an array that is 134459x10 that I store as a separate binary file; I read it in one row at a time and process that.Quote: ChrisEI'm fairly certain my problem is somewhere in populating the arrays before you even get to the 134459 hands portion... but I really don't know.
[ x ] failed AP giving programming advice ITT
Quote: RicardoEsteban[ ] skilled programmer giving programming advice ITT
[ x ] failed AP giving programming advice ITT
It's clear that you have no purpose here other than to follow Teliot around and attempt to insult him. Were I so obsessed with a person, I'd probably send flowers, or something.
NUKED-Trolling, Personal Insult
:(Quote: Mission146Quote: RicardoEsteban[ ] skilled programmer giving programming advice ITT
[ x ] failed AP giving programming advice ITT
It's clear that you have no purpose here other than to follow Teliot around and attempt to insult him. Were I so obsessed with a person, I'd probably send flowers, or something.
NUKED-Trolling, Personal Insult
Correct me if I'm wrong, but it looks like the technique described, using the results tables for partial hand results, and then going back and forth, adding and subtracting totals, can be used to calculate the ending totals any time you have a single deck with cards removed from it?
https://dl.dropboxusercontent.com/u/22699631/PokerEV/PokerEV.html
It still has a long way to go, but it will show the best play, plus if you push the Best Play button you'll get a list of all the EVs. They seem to check out with vpgenius so I think I've got that going correctly.
Quote: ChrisEFor anyone interested here's what I have so far on my game.
https://dl.dropboxusercontent.com/u/22699631/PokerEV/PokerEV.html
It still has a long way to go, but it will show the best play, plus if you push the Best Play button you'll get a list of all the EVs. They seem to check out with vpgenius so I think I've got that going correctly.
I tried to look, but even after I stall "unity player", it wouldn't run. It's probably my aging (4yo) Macbook Air that I don't keep up to date.
Did you get all the bugs worked out in your analyzer? I've been struggling trying to do the same thing (in a different language) since I saw this post. It's more of a pain than I thought it would be.