扑克算法手评估员

Jos*_*ake 3 c++ poker

我正在努力让我的扑克来评估玩家手牌.我可以让Flush和千斤顶或更好的一对工作,但我遇到了问题,弄清楚我将如何做其余的事情.关于我如何评估卡到适当类型的任何建议?

int Game::HandCheck()
{
    //ROYAL FLUSH
    //return 9;

    //STRAIGHT FLUSH
    //return 8;

    //FOUR OF A KIND
    //return 7;

    //FULL HOUSE
    //return 6;

    //FLUSH
    if( currentHand[ 0 ].GetSuit() == currentHand[ 1 ].GetSuit() && currentHand[ 1 ].GetSuit() == currentHand[ 2 ].GetSuit() &&
        currentHand[ 2 ].GetSuit() == currentHand[ 3 ].GetSuit() && currentHand[ 4 ].GetSuit() == currentHand[ 4 ].GetSuit() ) 
        return 5;

    //STRAIGHT
    //return 4;

    //THREE OF A KIND
    if( currentHand[ 0 ].GetValue() == currentHand[ 2 ].GetValue() && currentHand[ 0 ].GetValue() == currentHand[ 3 ].GetValue()
    //return 3;

    //TWO PAIR
    //return 2;

    //JACKS OR BETTER PAIR
    for( int i = 0; i < 5; i++ )
    {
        if( currentHand[ i ].GetValue() == 11 || currentHand[ i ].GetValue() == 12 || currentHand[ i ].GetValue() == 13 || currentHand[ i ].GetValue() == 1 )
        {
            if( currentHand[ i ].GetValue() == currentHand[ i + 1 ].GetValue() || currentHand[ i ].GetValue() == currentHand[ i + 2 ].GetValue() || //pair
            currentHand[ i ].GetValue() == currentHand[ i + 3 ].GetValue() || currentHand[ i ].GetValue() == currentHand[ i + 4 ].GetValue() )
            return 1;
        }
    }

    return 0;

}
Run Code Online (Sandbox Code Playgroud)

Ste*_*ens 5

我会创建一个直方图数组来进行计数.

填充阵列.如果只有一个桶有两个或更多的数量,你有一对,绊倒或四种.如果两个桶有两个或更多的数量,你有两个或一个满屋.