我正在努力让我的扑克评估玩家手牌。我可以让同花顺和千斤顶或更好的配对工作,但在弄清楚我将如何做剩下的事情时遇到了问题。关于如何将卡片评估为适当类型的任何建议?
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;
}