Rank: 55925 based on 0 downloads (last 30 days) and 0 file submitted
photo

MuffinMan

E-mail

Personal Profile:

 

Watch this Author's files

 

Comments and Ratings by MuffinMan View all
Updated File Comments Rating
27 Feb 2009 Poker hand ranker Function that evaluates poker hands, returns ranks and text descriptions. Author: Rob Slazas

Great starting point for a hand evaluator however still has issues and does not rank all hands correctly. I discovered this several months ago but didn't want to bother with registering to post a reply. After a coworker mentioned using this evaluator to prove an argument, I mentioned the shortcomings. Unfortunately now I can't remember the cases it fails at, but I recall the error is due to the arbitrary method of ranking hands by hashing the card numbers. In some cases hands that should not have the same rank are hashed to the same value. A easy test is to use combs=nchoosek([1:52],5); ranks=rankp(combs,5); unique(ranks) and you will find that all possible hands gives 6987 possible ranks using rankp, which is incorrect, and instead you should get 7462.

Once the total ranks checks out, you should test and find that there are 10 straight flushes, 156 four of a kinds and full houses, 1277 flushes, 10 straights, 858 trips and two pairs, 2860 pairs, and 1277 high card ranks. Otherwise, there is still an error.

As an aside, the 2+2 evaluator can do unordered evaluations of 5-7 card hands, at blazing speeds, and can easily be ported to Matlab.

27 Feb 2009 Poker hand ranker Function that evaluates poker hands, returns ranks and text descriptions. Author: Rob Slazas

Contact us