Next online event

February 26-27th 2025

Rain Man

Ranking service for Lean Poker running on https://rainman.leanpoker.org/rank. This service returns a JSON data structure representing a hand, once it is provided a list of cards.

How to call the ranking service

The ranking service expects a GET request with a variable named cards that contains a JSON encoded array of cards, in the following format:

{
    "rank":"5",         // String representation of the 
                        //     cards rank. Valid values are: 
                        //     2 through 10, and J,Q,K,A. 

    "suit":"diamonds"   // The suit of the card. Valid values
                        //     are: clubs, spades, hearts and diamonds
}

As an example this is how one can call the ranking service from command line:

curl -XGET -d 'cards=[
    {"rank":"5","suit":"diamonds"},
    {"rank":"6","suit":"diamonds"},
    {"rank":"7","suit":"diamonds"},
    {"rank":"7","suit":"spades"},
    {"rank":"8","suit":"diamonds"},
    {"rank":"9","suit":"diamonds"}
]' https://rainman.leanpoker.org/rank

Hand

Bellow is an example response for the curl call above. The rank specifies the type of hand that was recognized. The meaning of the value, second_value and kickers variables depends on the type of hand, and will be discussed after the example.

The cards_used array is a list of cards that make up the best hand. This variable is useful when more than 5 cards are passed to the service. In the cards array the original input is returned.

{
    "rank": 8,
    "value": 9,
    "second_value": 9,
    "kickers": [9, 8, 6, 5],
    "cards_used": [
        {
            "rank": "5",
            "suit": "diamonds"
        },
        {
            "rank": "6",
            "suit": "diamonds"
        },
        {
            "rank": "7",
            "suit": "diamonds"
        },
        {
            "rank": "8",
            "suit": "diamonds"
        },
        {
            "rank": "9",
            "suit": "diamonds"
        }
    ],
    "cards": [
        {
            "rank": "5",
            "suit": "diamonds"
        },
        {
            "rank": "6",
            "suit": "diamonds"
        },
        {
            "rank": "7",
            "suit": "diamonds"
        },
        {
            "rank": "7",
            "suit": "spades"
        },
        {
            "rank": "8",
            "suit": "diamonds"
        },
        {
            "rank": "9",
            "suit": "diamonds"
        }
    ]
}

For detailed definitions of poker hands, and their properties (such as probability of appearing during the game) check the List of poker hands page on Wikipedia.

The value of a card is its rank in case of numeric ranks. For Jack the value is 11, for Queen it's 12 and for King it is 13. The value of Ace depends on its position: it has a value of 1 when it's at the end of a straight formed by number cards 2 to 5 and the Ace. In all other cases the value of the Ace is 14.

rank idhand nameexamplefirst_valuesecond_valuekickers
0High cardK♥J♥8♣7♦4♠Value of the highest cardSame as valueValues of all five cards used in descending order
1Pair4♥4♠K♠10♦5♠Value of the cards forming the pairSame as valueValues of the three cards not in the pair in descending order
2Two pairsJ♥J♣4♣4♠9♥Value of the cards forming the higher pairValue of the cards forming the lower pairValue of the single kicker card
3Three of a kind2♦2♠2♣K♠6♥The value of the three cards with the same valueSame as valueValues of the two extra cards in descending order
4StraightQ♣J♠10♠9♥8♥Value of the highest cardSame as valueValues of all five cards used in descending order
5FlushQ♣10♣7♣6♣4♣Value of the highest cardSame as valueValues of all five cards used in descending order
6Full house3♣3♠3♦6♣6♥Value of the three identical cardsValue of the two identical cardsEmpty array
7Four of a kind9♣9♠9♦9♥J♥Value of the four identical cardsSame as valueValue of the single kicker card
8Straight flushQ♣J♣10♣9♣8♣Value of the highest cardSame as valueValues of all five cards used in descending order