Poker hand ranker

Function that evaluates poker hands, returns ranks and text descriptions.
3,8K descargas
Actualizado 2 sep 2008

Sin licencia

A function that evaluates poker hands and returns a numerical rank and text description for each. The list of cards used to make the best possible hand is returned in 'usedcards'. If handsize is smaller than the length of hands given, then the cards not used in the best possible hand are returned in 'unusedcards'. Rank of 1 is best (Royal Flush), higher numbers are worse. Rank values are not contiguous across all hands, but are correctly ordered.

The hand matrix expected is an mxn list of m hands with n cards. The cards are numbered from 1 to 52. Suit doesn't matter for ranking. Order of the cards in the input vector does not matter. Numbering starts with the Ace at position 1. Here is a suggested card assignment:

A | K | Q | J | 10| 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | Suit
-------------------------------------------------------------
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12| 13| Spades
14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| Hearts
27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| Clubs
40| 41| 42| 43| 44| 45| 46| 47| 48| 49| 50| 51| 52| Diamonds

Example call to the function:
trick = [33,3,43,1,25,4,19;
6,36,20,10,35,21,38;
45,31,51,40,37,22,26;
28,49,46,32,17,16,39];
[ranks,descriptions,usedcards,unusedcards] = rankp(trick,2);

Citar como

Rob Slazas (2024). Poker hand ranker (https://www.mathworks.com/matlabcentral/fileexchange/17579-poker-hand-ranker), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2007b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Card games en Help Center y MATLAB Answers.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versión Publicado Notas de la versión
1.0.0.0

revision 5 - fixed a conditional error in the numerical ranking section, thanks to Tim C. for testing it.