calcHandsChance

This commit is contained in:
floty
2008-10-17 10:58:03 +00:00
parent dae1eb1605
commit 9d77cbedeb
6 changed files with 43 additions and 22 deletions
+10 -8
View File
@@ -563,15 +563,17 @@ int array[7][3];
}
int* CardsValue::calcCardsChance(GameState beRoID, int* playerCards, int* boardCards)
int** CardsValue::calcCardsChance(GameState beRoID, int* playerCards, int* boardCards)
{
int i,j;
int* hand = new int[10];
int** hand = new int*[10];
int cards[7];
int sum = 0;
for(i=0;i<10;i++) hand[i] = 0;
for(i=0;i<10;i++) {
for(j=0;j<2;j++) hand[i][j] = 0;
}
cards[0] = playerCards[0];
cards[1] = playerCards[1];
@@ -595,14 +597,14 @@ int* CardsValue::calcCardsChance(GameState beRoID, int* playerCards, int* boardC
if(j!=cards[0] && j!=cards[1] && j!=cards[2] && j!=cards[3] && j!=cards[4]) {
cards[5] = i;
cards[6] = j;
hand[cardsValue(cards,0)/100000000]++;
(hand[cardsValue(cards,0)/100000000][0])++;
sum++;
}
}
}
}
for(i=0;i<10;i++) {
hand[i] = (int)(((double)hand[i]/(double)sum)*100.0+0.5);
hand[i][0] = (int)(((double)hand[i][0]/(double)sum)*100.0+0.5);
}
} break;
@@ -611,17 +613,17 @@ int* CardsValue::calcCardsChance(GameState beRoID, int* playerCards, int* boardC
for(i=0;i<52;i++) {
if(i!=cards[0] && i!=cards[1] && i!=cards[2] && i!=cards[3] && i!=cards[4] && i!=cards[5]) {
cards[6] = i;
hand[cardsValue(cards,0)/100000000]++;
(hand[cardsValue(cards,0)/100000000][0])++;
sum++;
}
}
for(i=0;i<10;i++) {
hand[i] = (int)(((double)hand[i]/(double)sum)*100.0+0.5);
hand[i][0] = (int)(((double)hand[i][0]/(double)sum)*100.0+0.5);
}
} break;
case GAME_STATE_RIVER: {
hand[cardsValue(cards,0)/100000000] = 100;
hand[cardsValue(cards,0)/100000000][0] = 100;
} break;
default: {
}