Problem 54149. Determine Poker Hand Winner
Solution Stats
Problem Comments
-
8 Comments
I am getting different results on many hands. Examples:
hand1{205} has a full house with 9 and 7
hand2{205} has a full house with 4 and 10
player 1 should win, but does not
hand1{67} has a flush with high card of 11
hand2{67} has a full house with 12 and 3
player 2 should win but it is rated a tie
hand1{67} has a full house with 6 and 9
hand2{67} has a flush with high card of aa
player 1 should with but it is rated a tie
Yes, I had a few problems. I believe the test suite is fixed now.
David,
Ah. Much better, but still a couple discrepancies. We agree on all the ties. But among the first 100 hands, I have 2 more wins for player 1, and 2 fewer wins for player 2, than you do. Unfortunately, I can't tell what hands they are because the tw_correct and to_correct lists just start at the 100th hand. I just know that my tw list starts at 229, and my to list begins with [181, 183, 186 ...] After that, they agree perfectly.
Maybe if you could send me your list of winning players (1 or 2) for the first 100 hands ...
Our lists for the first 100 winners is now identical. However my tw() list begins [173, 177, 183, 184, ...] and my to() list begins [227, 229, 230 ...]. We agree that there are no ties in the tz() list. But your list for the first 100 wins for player 2 must have 1 fewer than mine, and your list for the first 100 wins for player 1 must have 2 more than mine. I can't think of any good way to resolve that other than to compare those lists. From the list of the first 100 winners, we know that approx. the first 50 entries in each of our lists of wins for players 1 and 2 will be the same.
Our differences on the first 100 winds by each player are these:
1) hand #142 was awarded to player 1. But player 1 has nothing, while player 2 has 2 pair, so player 2 should have won.
2) hand #219 was awarded to player 1. But player 1 has a pair of 12's, while player 2 has 2 pair, so player 2 should have won.
Both hand1{142} and hand1{219} are straights with the ace coming down to function low (A 2 3 4 5}. I should have noted that in the rules since some poker games do not allow that, but many also do.
Thanks David, that fixed it. I never actually played poker, so I had to look up the rules. There are a lot of varieties!
Solution Comments
Show commentsProblem Recent Solvers3
Suggested Problems
-
Find the alphabetic word product
3318 Solvers
-
222 Solvers
-
Find the sum of the elements in the "second" diagonal
1146 Solvers
-
485 Solvers
-
417 Solvers
More from this Author56
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!