calcHandsChance
This commit is contained in:
@@ -1017,6 +1017,9 @@ static const calcHandsData handChancePreflop[] =
|
||||
{ 12120, { { 0,0}, { 36,1}, { 40,1}, { 12,1}, { 1,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } }
|
||||
};
|
||||
|
||||
#define NUM_PREFLOP_VALUES (sizeof(PreflopValues)/sizeof(RoundData))
|
||||
#define NUM_FLOP_VALUES (sizeof(FlopValues)/sizeof(RoundData))
|
||||
#define NUM_HAND_CHANCE_PREFLOP (sizeof(handChancePreflop)/sizeof(calcHandsData))
|
||||
|
||||
ArrayData::ArrayData()
|
||||
{
|
||||
@@ -1025,3 +1028,19 @@ ArrayData::ArrayData()
|
||||
ArrayData::~ArrayData()
|
||||
{
|
||||
}
|
||||
|
||||
void ArrayData::getHandChancePreflop(int handCode, int** values) {
|
||||
|
||||
for (unsigned val = 0; val < NUM_HAND_CHANCE_PREFLOP; val++) {
|
||||
if(handCode == handChancePreflop[val].hand) {
|
||||
for(int i=0;i<10;i++) {
|
||||
for(int j=0;j<2;j++) {
|
||||
values[i][j] = handChancePreflop[val].data[i][j];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if (myOdds == -1) LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR myOdds - " << handCode);
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
|
||||
~ArrayData();
|
||||
|
||||
int* getHandChancePreflop(int);
|
||||
void getHandChancePreflop(int, int**);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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: {
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
int holeCardsToIntCode(int*);
|
||||
int* intCodeToHoleCards(int);
|
||||
|
||||
int* calcCardsChance(GameState, int*, int*);
|
||||
int** calcCardsChance(GameState, int*, int*);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -23,18 +23,18 @@ MyChanceLabel::~MyChanceLabel()
|
||||
{
|
||||
}
|
||||
|
||||
void MyChanceLabel::refreshChance(int *chance)
|
||||
void MyChanceLabel::refreshChance(int **chance)
|
||||
{
|
||||
RFChance = chance[9];
|
||||
SFChance = chance[8];
|
||||
FOAKChance = chance[7];
|
||||
FHChance = chance[6];
|
||||
FLChance = chance[5];
|
||||
STRChance = chance[4];
|
||||
TOAKChance = chance[3];
|
||||
TPChance = chance[2];
|
||||
OPChance = chance[1];
|
||||
HCChance = chance[0];
|
||||
RFChance = chance[9][0];
|
||||
SFChance = chance[8][0];
|
||||
FOAKChance = chance[7][0];
|
||||
FHChance = chance[6][0];
|
||||
FLChance = chance[5][0];
|
||||
STRChance = chance[4][0];
|
||||
TOAKChance = chance[3][0];
|
||||
TPChance = chance[2][0];
|
||||
OPChance = chance[1][0];
|
||||
HCChance = chance[0][0];
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
|
||||
void setMyW ( gameTableImpl* theValue ) { myW = theValue; }
|
||||
void paintEvent(QPaintEvent * event);
|
||||
void refreshChance(int*);
|
||||
void refreshChance(int**);
|
||||
void resetChance();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user