Problem 54010. Evaluate Poker Hand
Given an input table of card values and card suits between five and thirteen cards, choose the best five cards and output the rank and an array of kickers (most significant first). Report rank as follows: straight flush=1, four-of-kind=2, full-house=3, flush=4, straight=5, three-of-kind=6, two pairs=7, pair=8, high card=9. Report array of kickers as the value of the most important cards first (some hands will only have a single kicker while others might have five different kickers). Values of cards are as follows: 2:10,jack,queen,king,ace == 1:13. Suits of cards are as follows: clubs, diamonds, hearts, spades == 1:4.
Example:
hand=table([9 3 10 7 13 12 11]',[3 2 3 4 3 3 3]');
hand.Properties.VariableNames={'value','suit'};
[rank,kickers]=evalHand(hand)
rank =
1
kickers =
13
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers4
Suggested Problems
-
3797 Solvers
-
Determine Whether an array is empty
806 Solvers
-
The Answer to Life, the Universe, and Everything
572 Solvers
-
307 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
395 Solvers
More from this Author61
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!