calcHandsChance

This commit is contained in:
floty
2008-10-17 09:48:37 +00:00
parent 716e45c881
commit 77a66b310d
7 changed files with 1140 additions and 257 deletions
File diff suppressed because it is too large Load Diff
+32
View File
@@ -0,0 +1,32 @@
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef ARRAYDATA_H
#define ARRAYDATA_H
class ArrayData{
public:
ArrayData();
~ArrayData();
int* getHandChancePreflop(int);
};
#endif
+69 -1
View File
@@ -560,6 +560,74 @@ int array[7][3];
}
}
return array[0][1]*1000000+array[1][1]*10000+array[2][1]*100+array[3][1]*10+array[4][1];
}
}
int* CardsValue::calcCardsChance(GameState beRoID, int* playerCards, int* boardCards)
{
int i,j;
int* hand = new int[10];
int cards[7];
int sum = 0;
for(i=0;i<10;i++) hand[i] = 0;
cards[0] = playerCards[0];
cards[1] = playerCards[1];
for(i=0;i<5;i++) cards[i+2] = boardCards[i];
switch(beRoID) {
case GAME_STATE_PREFLOP: {
// int rand[5];
// for(i=0;i<preflopCalcNumber;i++) {
// getRandNumber(0,51,5,rand,1,playerCards);
//
// }
} break;
case GAME_STATE_FLOP: {
for(i=0;i<51;i++) {
if(i!=cards[0] && i!=cards[1] && i!=cards[2] && i!=cards[3] && i!=cards[4]) {
for(j=i+1;j<52;j++) {
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]++;
sum++;
}
}
}
}
for(i=0;i<10;i++) {
hand[i] = (int)(((double)hand[i]/(double)sum)*100.0+0.5);
}
} break;
case GAME_STATE_TURN: {
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]++;
sum++;
}
}
for(i=0;i<10;i++) {
hand[i] = (int)(((double)hand[i]/(double)sum)*100.0+0.5);
}
} break;
case GAME_STATE_RIVER: {
hand[cardsValue(cards,0)/100000000] = 100;
} break;
default: {
}
}
return hand;
}
+3
View File
@@ -20,6 +20,7 @@
#ifndef CARDSVALUE_H
#define CARDSVALUE_H
#include "game_defs.h"
class CardsValue{
public:
@@ -33,6 +34,8 @@ public:
int holeCardsToIntCode(int*);
int* intCodeToHoleCards(int);
int* calcCardsChance(GameState, int*, int*);
};
#endif
-250
View File
@@ -27,185 +27,6 @@
using namespace std;
struct calcHandsData
{
int hand;
int data[10][2];
};
static const calcHandsData PreflopValues[] =
{
{ 0, { { 0,0}, { 36,1}, { 40,1}, { 12,1}, { 1,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } },
{ 10, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 5,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 11, { { 18,1}, { 42,1}, { 22,1}, { 4,1}, { 5,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 20, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 5,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 21, { { 17,1}, { 42,1}, { 22,1}, { 4,1}, { 5,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 30, { { 19,1}, { 44,1}, { 23,1}, { 4,1}, { 6,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 31, { { 17,1}, { 42,1}, { 22,1}, { 4,1}, { 5,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 40, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 4,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 41, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 4,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 50, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 51, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 2,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 60, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 61, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 70, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 71, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 80, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 81, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 90, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 91, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 100, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 2,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 101, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 2,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 110, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 2,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 111, { { 19,1}, { 44,1}, { 22,1}, { 4,1}, { 2,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 120, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 121, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1010, { { 0,0}, { 36,1}, { 40,1}, { 12,1}, { 2,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } },
{ 1020, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 7,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1021, { { 17,1}, { 42,1}, { 22,1}, { 4,1}, { 7,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1030, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 7,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1031, { { 16,1}, { 41,1}, { 22,1}, { 4,1}, { 7,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1040, { { 19,1}, { 44,1}, { 23,1}, { 4,1}, { 6,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1041, { { 17,1}, { 42,1}, { 22,1}, { 4,1}, { 5,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1050, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 4,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1051, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 4,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1060, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1061, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1070, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1071, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1080, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1081, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1090, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1091, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1100, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1101, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1110, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 2,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1111, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 2,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1120, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 4,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 1121, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2020, { { 0,0}, { 35,1}, { 40,1}, { 12,1}, { 2,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } },
{ 2030, { { 17,1}, { 43,1}, { 22,1}, { 4,1}, { 9,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2031, { { 16,1}, { 41,1}, { 22,1}, { 4,1}, { 9,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2040, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 7,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2041, { { 17,1}, { 41,1}, { 22,1}, { 4,1}, { 7,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2050, { { 18,1}, { 44,1}, { 23,1}, { 4,1}, { 6,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2051, { { 17,1}, { 42,1}, { 22,1}, { 4,1}, { 6,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2060, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 5,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2061, { { 17,1}, { 43,1}, { 22,1}, { 4,1}, { 4,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2070, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2071, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2080, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 4,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2081, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 4,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2090, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2091, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2100, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2101, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2110, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2111, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2120, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 4,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 2121, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 4,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3030, { { 0,0}, { 35,1}, { 39,1}, { 12,1}, { 2,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } },
{ 3040, { { 17,1}, { 43,1}, { 22,1}, { 4,1}, { 9,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3041, { { 16,1}, { 41,1}, { 22,1}, { 4,1}, { 9,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3050, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 8,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3051, { { 16,1}, { 41,1}, { 22,1}, { 4,1}, { 7,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3060, { { 18,1}, { 44,1}, { 23,1}, { 4,1}, { 6,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3061, { { 17,1}, { 42,1}, { 22,1}, { 4,1}, { 6,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3070, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 5,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3071, { { 17,1}, { 43,1}, { 22,1}, { 4,1}, { 5,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3080, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 4,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3081, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 4,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3090, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 4,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3091, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 4,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3100, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3101, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3110, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3111, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3120, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 4,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 3121, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 4,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4040, { { 0,0}, { 35,1}, { 39,1}, { 12,1}, { 2,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } },
{ 4050, { { 17,1}, { 43,1}, { 22,1}, { 4,1}, { 9,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4051, { { 16,1}, { 41,1}, { 22,1}, { 4,1}, { 9,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4060, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 8,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4061, { { 16,1}, { 41,1}, { 22,1}, { 4,1}, { 7,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4070, { { 18,1}, { 44,1}, { 23,1}, { 4,1}, { 6,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4071, { { 17,1}, { 42,1}, { 22,1}, { 4,1}, { 6,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4080, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 5,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4081, { { 17,1}, { 43,1}, { 22,1}, { 4,1}, { 5,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4090, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4091, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4100, { { 19,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4101, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4110, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4111, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4120, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 4121, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 2,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5050, { { 0,0}, { 35,1}, { 39,1}, { 12,1}, { 2,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } },
{ 5060, { { 17,1}, { 43,1}, { 22,1}, { 4,1}, { 9,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5061, { { 16,1}, { 41,1}, { 22,1}, { 4,1}, { 9,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5070, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 8,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5071, { { 16,1}, { 41,1}, { 22,1}, { 4,1}, { 7,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5080, { { 18,1}, { 44,1}, { 23,1}, { 4,1}, { 6,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5081, { { 17,1}, { 42,1}, { 22,1}, { 4,1}, { 6,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5090, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 5,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5091, { { 17,1}, { 43,1}, { 22,1}, { 4,1}, { 4,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5100, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5101, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5110, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5111, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5120, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 5121, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 6060, { { 0,0}, { 35,1}, { 39,1}, { 12,1}, { 2,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } },
{ 6070, { { 17,1}, { 43,1}, { 22,1}, { 4,1}, { 9,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 6071, { { 16,1}, { 41,1}, { 22,1}, { 4,1}, { 9,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 6080, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 8,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 6081, { { 16,1}, { 41,1}, { 22,1}, { 4,1}, { 7,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 6090, { { 18,1}, { 44,1}, { 23,1}, { 4,1}, { 6,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 6091, { { 17,1}, { 42,1}, { 22,1}, { 4,1}, { 6,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 6100, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 4,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 6101, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 4,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 6110, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 6111, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 2,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 6120, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 6121, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 7070, { { 0,0}, { 35,1}, { 39,1}, { 12,1}, { 2,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } },
{ 7080, { { 17,1}, { 43,1}, { 22,1}, { 4,1}, { 9,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 7081, { { 16,1}, { 41,1}, { 22,1}, { 4,1}, { 9,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 7090, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 7,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 7091, { { 17,1}, { 41,1}, { 22,1}, { 4,1}, { 7,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 7100, { { 19,1}, { 44,1}, { 23,1}, { 4,1}, { 6,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 7101, { { 17,1}, { 42,1}, { 22,1}, { 4,1}, { 5,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 7110, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 4,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 7111, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 4,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 7120, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 7121, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 2,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 8080, { { 0,0}, { 35,1}, { 39,1}, { 12,1}, { 2,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } },
{ 8090, { { 17,1}, { 43,1}, { 22,1}, { 4,1}, { 9,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 8091, { { 16,1}, { 41,1}, { 22,1}, { 4,1}, { 9,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 8100, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 7,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 8101, { { 16,1}, { 41,1}, { 22,1}, { 4,1}, { 7,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 8110, { { 19,1}, { 44,1}, { 23,1}, { 4,1}, { 6,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 8111, { { 17,1}, { 42,1}, { 22,1}, { 4,1}, { 5,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 8120, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 4,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 8121, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 4,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 9090, { { 0,0}, { 35,1}, { 40,1}, { 12,1}, { 2,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } },
{ 9100, { { 18,1}, { 44,1}, { 22,1}, { 4,1}, { 7,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 9101, { { 17,1}, { 42,1}, { 22,1}, { 4,1}, { 7,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 9110, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 5,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 9111, { { 17,1}, { 42,1}, { 22,1}, { 4,1}, { 5,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 9120, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 4,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 9121, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 4,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 10100, { { 0,0}, { 36,1}, { 40,1}, { 12,1}, { 2,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } },
{ 10110, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 5,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 10111, { { 18,1}, { 42,1}, { 22,1}, { 4,1}, { 5,1}, { 6,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 10120, { { 19,1}, { 45,1}, { 23,1}, { 4,1}, { 4,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 10121, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 11110, { { 0,0}, { 36,1}, { 40,1}, { 12,1}, { 1,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } },
{ 11120, { { 20,1}, { 46,1}, { 23,1}, { 4,1}, { 3,1}, { 2,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 11121, { { 18,1}, { 43,1}, { 22,1}, { 4,1}, { 3,1}, { 7,1}, { 2,1}, { 0,1}, { 0,1}, { 0,1} } },
{ 12120, { { 0,0}, { 36,1}, { 40,1}, { 12,1}, { 1,1}, { 2,1}, { 9,1}, { 1,1}, { 0,1}, { 0,1} } }
};
void Tools::getRandNumber(int start, int end, int howMany, int* randArray, bool different, int* bad) {
int r = end-start+1;
@@ -276,75 +97,4 @@ void Tools::getRandNumber(int start, int end, int howMany, int* randArray, bool
}
int* Tools::calcCardsChance(GameState beRoID, int* playerCards, int* boardCards)
{
CardsValue* myCardsValue = new CardsValue;
// int preflopCalcNumber = 10000;
int i,j;
int* hand = new int[10];
int cards[7];
int sum = 0;
for(i=0;i<10;i++) hand[i] = 0;
cards[0] = playerCards[0];
cards[1] = playerCards[1];
for(i=0;i<5;i++) cards[i+2] = boardCards[i];
switch(beRoID) {
case GAME_STATE_PREFLOP: {
// int rand[5];
// for(i=0;i<preflopCalcNumber;i++) {
// getRandNumber(0,51,5,rand,1,playerCards);
//
// }
} break;
case GAME_STATE_FLOP: {
for(i=0;i<51;i++) {
if(i!=cards[0] && i!=cards[1] && i!=cards[2] && i!=cards[3] && i!=cards[4]) {
for(j=i+1;j<52;j++) {
if(j!=cards[0] && j!=cards[1] && j!=cards[2] && j!=cards[3] && j!=cards[4]) {
cards[5] = i;
cards[6] = j;
hand[(myCardsValue->cardsValue(cards,0))/100000000]++;
sum++;
}
}
}
}
for(i=0;i<10;i++) {
hand[i] = (int)(((double)hand[i]/(double)sum)*100.0+0.5);
}
} break;
case GAME_STATE_TURN: {
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[(myCardsValue->cardsValue(cards,0))/100000000]++;
sum++;
}
}
for(i=0;i<10;i++) {
hand[i] = (int)(((double)hand[i]/(double)sum)*100.0+0.5);
}
} break;
case GAME_STATE_RIVER: {
hand[(myCardsValue->cardsValue(cards,0))/100000000] = 100;
} break;
default: {
}
}
delete myCardsValue;
return hand;
}
+1 -4
View File
@@ -20,13 +20,10 @@
#ifndef TOOLS_H
#define TOOLS_H
#include "game_defs.h"
#include "cardsvalue.h"
class Tools{
public:
static void getRandNumber(int, int, int, int*, bool, int* = 0);
static int* calcCardsChance(GameState, int*, int*);
};
#endif
+8 -2
View File
@@ -36,7 +36,7 @@
#include "handinterface.h"
#include "game.h"
#include "session.h"
#include "tools.h"
#include "cardsvalue.h"
#include "configfile.h"
#include "sdlplayer.h"
@@ -3147,6 +3147,9 @@ void gameTableImpl::refreshVotesMonitor()
void gameTableImpl::refreshCardsChance(GameState bero)
{
CardsValue* myCardsValue = new CardsValue;
if(myConfig->readConfigInt("ShowCardsChanceMonitor")) {
if((*myStartWindow->getSession()->getCurrentGame()->getSeatsList()->begin())->getMyActiveStatus() && (*myStartWindow->getSession()->getCurrentGame()->getSeatsList()->begin())->getMyAction() != PLAYER_ACTION_FOLD) {
@@ -3156,11 +3159,14 @@ void gameTableImpl::refreshCardsChance(GameState bero)
(*myStartWindow->getSession()->getCurrentGame()->getSeatsList()->begin())->getMyCards(holeCards);
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
label_chance->refreshChance(Tools::calcCardsChance(bero, holeCards, boardCards));
label_chance->refreshChance(myCardsValue->calcCardsChance(bero, holeCards, boardCards));
}
else {
label_chance->resetChance();
}
}
delete myCardsValue;
}