engine 0.4 rev2 (preflop part 1)
This commit is contained in:
@@ -68,6 +68,9 @@ public:
|
|||||||
virtual void setActivePlayersCounter(const int& theValue) =0;
|
virtual void setActivePlayersCounter(const int& theValue) =0;
|
||||||
virtual int getActivePlayersCounter() const =0;
|
virtual int getActivePlayersCounter() const =0;
|
||||||
|
|
||||||
|
virtual void setBettingRoundsPlayed(const int& theValue) =0;
|
||||||
|
virtual int getBettingRoundsPlayed() const =0;
|
||||||
|
|
||||||
virtual void assignButtons() =0;
|
virtual void assignButtons() =0;
|
||||||
|
|
||||||
virtual void highlightRoundLabel() =0;
|
virtual void highlightRoundLabel() =0;
|
||||||
|
|||||||
@@ -83,6 +83,12 @@ void LocalFlop::flopRun() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Flop ist wirklich dran
|
// Flop ist wirklich dran
|
||||||
|
|
||||||
|
// Anzahl der effektiv gespielten Runden (des human player) erhöhen
|
||||||
|
if(myHand->getPlayerArray()[0]->getMyActiveStatus() && myHand->getPlayerArray()[0]->getMyAction() != 1) {
|
||||||
|
myHand->setBettingRoundsPlayed(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// n�hsten Spieler ermitteln
|
// n�hsten Spieler ermitteln
|
||||||
do { playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers());
|
do { playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers());
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC) : HandInterface(), myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), allInCondition(0)
|
LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC) : HandInterface(), myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), allInCondition(0), bettingRoundsPlayed(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|||||||
@@ -78,11 +78,14 @@ public:
|
|||||||
void setActivePlayersCounter(const int& theValue) { activePlayersCounter = theValue; }
|
void setActivePlayersCounter(const int& theValue) { activePlayersCounter = theValue; }
|
||||||
int getActivePlayersCounter() const { return activePlayersCounter; }
|
int getActivePlayersCounter() const { return activePlayersCounter; }
|
||||||
|
|
||||||
|
void setBettingRoundsPlayed(const int& theValue) { bettingRoundsPlayed = theValue; }
|
||||||
|
int getBettingRoundsPlayed() const { return bettingRoundsPlayed; }
|
||||||
|
|
||||||
void assignButtons();
|
void assignButtons();
|
||||||
|
|
||||||
void highlightRoundLabel();
|
void highlightRoundLabel();
|
||||||
void switchRounds();
|
void switchRounds();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -109,9 +112,12 @@ private:
|
|||||||
int actualRound; //0 = preflop, 1 = flop, 2 = turn, 3 = river
|
int actualRound; //0 = preflop, 1 = flop, 2 = turn, 3 = river
|
||||||
int smallBlind;
|
int smallBlind;
|
||||||
int startCash;
|
int startCash;
|
||||||
int activePlayersCounter;
|
int activePlayersCounter;
|
||||||
|
|
||||||
bool allInCondition;
|
bool allInCondition;
|
||||||
|
|
||||||
|
// hier steht bis zu welcher bettingRound der human player gespielt hat: 0 - nur Preflop, 1 - bis Flop, ...
|
||||||
|
int bettingRoundsPlayed;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
LocalPlayer::LocalPlayer(BoardInterface *b, int id, std::string name, int sC, bool aS, int mB) : PlayerInterface(), actualHand(0), actualBoard(b), myCardsValue(0), myID(id), myName(name), myDude(0), myCardsValueInt(0), myHoleCardsValue(0), myCash(sC), mySet(0), myAction(0), myButton(mB), myActiveStatus(aS), myTurn(0), myRoundStartCash(0), myAverageSets(0)
|
LocalPlayer::LocalPlayer(BoardInterface *b, int id, std::string name, int sC, bool aS, int mB) : PlayerInterface(), actualHand(0), actualBoard(b), myCardsValue(0), myID(id), myName(name), myDude(0), myDude4(0), myCardsValueInt(0), myHoleCardsValue(0), myCash(sC), mySet(0), myAction(0), myButton(mB), myActiveStatus(aS), myTurn(0), myRoundStartCash(0)
|
||||||
{
|
{
|
||||||
// myBestHandPosition mit -1 initialisieren
|
// myBestHandPosition mit -1 initialisieren
|
||||||
int i;
|
int i;
|
||||||
@@ -31,6 +31,11 @@ LocalPlayer::LocalPlayer(BoardInterface *b, int id, std::string name, int sC, bo
|
|||||||
myBestHandPosition[i] = -1;
|
myBestHandPosition[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// myAverageSets initialisieren
|
||||||
|
for(i=0; i<4; i++) {
|
||||||
|
myAverageSets[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Tools myTool;
|
Tools myTool;
|
||||||
// Dude zuweisen
|
// Dude zuweisen
|
||||||
@@ -38,12 +43,15 @@ LocalPlayer::LocalPlayer(BoardInterface *b, int id, std::string name, int sC, bo
|
|||||||
// cout << "Spieler: " << myID << " Dude: " << myDude << " Cash: " << myCash << " ActiveStatus: " << myActiveStatus << " Button: " << myButton << endl;
|
// cout << "Spieler: " << myID << " Dude: " << myDude << " Cash: " << myCash << " ActiveStatus: " << myActiveStatus << " Button: " << myButton << endl;
|
||||||
|
|
||||||
// Dude4 zuweisen
|
// Dude4 zuweisen
|
||||||
|
int interval = 7;
|
||||||
|
int count = 4;
|
||||||
|
|
||||||
int tempArray[4];
|
int tempArray[4];
|
||||||
myTool.getRandNumber(0, 14, 4, tempArray, 0);
|
myTool.getRandNumber(0, 2*interval, count, tempArray, 0);
|
||||||
for(i=0; i<4; i++) {
|
for(i=0; i<count; i++) {
|
||||||
myDude4 += tempArray[i];
|
myDude4 += tempArray[i];
|
||||||
}
|
}
|
||||||
myDude4 = (myDude4/4)-7;
|
myDude4 = (myDude4/count)-interval;
|
||||||
|
|
||||||
|
|
||||||
myCardsValue = new CardsValue;
|
myCardsValue = new CardsValue;
|
||||||
@@ -109,185 +117,100 @@ void LocalPlayer::action() {
|
|||||||
|
|
||||||
void LocalPlayer::preflopEngine() {
|
void LocalPlayer::preflopEngine() {
|
||||||
|
|
||||||
// Code der HoleCards ermitteln
|
|
||||||
int handCode;
|
|
||||||
if(myCards[0]%13 == myCards[1]%13) {
|
|
||||||
handCode = (myCards[0]%13)*1000 + (myCards[0]%13)*10;
|
|
||||||
} else {
|
|
||||||
if(myCards[0]%13 < myCards[1]%13) {
|
|
||||||
if(myCards[0]/13 == myCards[1]/13) {
|
|
||||||
handCode = (myCards[0]%13)*1000 + (myCards[1]%13)*10 + 1;
|
|
||||||
} else {
|
|
||||||
handCode = (myCards[0]%13)*1000 + (myCards[1]%13)*10;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(myCards[0]/13 == myCards[1]/13) {
|
|
||||||
handCode = (myCards[1]%13)*1000 + (myCards[0]%13)*10 + 1;
|
|
||||||
} else {
|
|
||||||
handCode = (myCards[1]%13)*1000 + (myCards[0]%13)*10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigFile myConfig;
|
ConfigFile myConfig;
|
||||||
std::string fileName = myConfig.readConfigString("DataDir")+"preflopValues";
|
if(myConfig.readConfigInt("EngineVersion")) {
|
||||||
|
// cout << "Engine 0.3" << endl;
|
||||||
ifstream fin;
|
|
||||||
|
|
||||||
fin.open(fileName.c_str());
|
|
||||||
if(!fin) {
|
|
||||||
cout << "Es ist nicht möglich " << fileName << " zum lesen zu oeffnen." << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
char buffer[50];
|
|
||||||
char hand[5];
|
|
||||||
int i,j,k;
|
|
||||||
char preflopValue[8];
|
|
||||||
myHoleCardsValue = -1.;
|
|
||||||
while(fin.getline(buffer,50)) {
|
|
||||||
for(i=0; i<5; i++) hand[i] = buffer[i];
|
|
||||||
if(handCode == atoi(hand)) {
|
|
||||||
j = 0;
|
|
||||||
k = 2;
|
|
||||||
while(buffer[j] != '|' || k < actualHand->getActualQuantityPlayers()) {
|
|
||||||
if(buffer[j] == '|') k++;
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
for(k=0; k<8 ; k++) preflopValue[k] = buffer[k+j+1];
|
|
||||||
myHoleCardsValue = 100*atof(preflopValue);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fin.close();
|
|
||||||
if(myHoleCardsValue == -1) cout << "ERROR myHoleCardsValue" << endl;
|
|
||||||
|
|
||||||
// Niveaus setzen
|
|
||||||
// 1. Fold -- Call
|
|
||||||
myNiveau[0] = 49 - 8*(actualHand->getActualQuantityPlayers() - 2);
|
|
||||||
// 2. Check -- Bet
|
|
||||||
myNiveau[1] = 50;
|
|
||||||
// 3. Call -- Raise
|
|
||||||
myNiveau[2] = 70;
|
|
||||||
|
|
||||||
|
|
||||||
// mySet += myCash;
|
|
||||||
// myCash = 0;
|
|
||||||
// myAction = 6;
|
|
||||||
// if(mySet > actualHand->getPreflop()->getHighestSet()) actualHand->getPreflop()->setHighestSet(mySet);
|
|
||||||
|
|
||||||
// cout << "Spieler " << myID << ": Dude " << myDude4 << "\t Wert " << myHoleCardsValue << "\t Niveau " << myNiveau[0] << " " << myNiveau[1] << " " << myNiveau[2] << " " << endl;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// cout << "nextID " << actualHand->getPlayerArray()[(myID+1)%5]->getMyID() << endl;
|
|
||||||
|
|
||||||
Tools myTool;
|
|
||||||
int raise = 0;
|
|
||||||
|
|
||||||
// Bauchgefhl (zufï¿Ålig)
|
|
||||||
int tempRand;
|
|
||||||
myTool.getRandNumber(1,10,1,&tempRand,0);
|
|
||||||
|
|
||||||
// bluff, checkbluff
|
|
||||||
int bluff;
|
|
||||||
myTool.getRandNumber(1,100,1,&bluff,0);
|
|
||||||
|
|
||||||
// cout << "preflop-bluff " << bluff << endl;
|
|
||||||
|
|
||||||
// Potential
|
|
||||||
int potential = 10*(4*(myCardsValue->holeCardsClass(myCards[0], myCards[1]))+1*tempRand)/50-myDude;
|
|
||||||
|
|
||||||
int setToHighest = actualHand->getPreflop()->getHighestSet() - mySet;
|
|
||||||
|
|
||||||
// temp fr das Vielfache des Small Blind, sodass HighestSet zu hoch ist
|
|
||||||
int tempFold;
|
|
||||||
// tempFold = (actualHand->getPlayerArray()[0]->getMyAverageSets())/(8*actualHand->getSmallBlind());
|
|
||||||
myTool.getRandNumber(2,3,1,&tempFold,0);
|
|
||||||
|
|
||||||
// FOLD --> wenn Potential negativ oder HighestSet zu hoch
|
|
||||||
if( (potential*setToHighest<0 || (setToHighest > tempFold * actualHand->getSmallBlind() && potential<1) || (setToHighest > 2 * tempFold * actualHand->getSmallBlind() && potential<2) || (setToHighest > 4 * tempFold * actualHand->getSmallBlind() && potential<3) || (setToHighest > 10 * tempFold * actualHand->getSmallBlind() && potential<4)) && myCardsValue->holeCardsClass(myCards[0], myCards[1]) < 9 && bluff > 15) {
|
|
||||||
myAction=1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// RAISE --> wenn hohes Potential
|
|
||||||
if(potential >= 4 && 6 * actualHand->getSmallBlind() >= actualHand->getPreflop()->getHighestSet() || bluff <= 6) {
|
|
||||||
// extrem hohes Potential --> groï¿År Raise
|
|
||||||
if(potential>=6 || bluff <= 2) {
|
|
||||||
|
|
||||||
// bluff - raise
|
|
||||||
if(bluff <=2 && 4 * actualHand->getSmallBlind() > actualHand->getPreflop()->getHighestSet()) {
|
|
||||||
raise = 3 * actualHand->getPreflop()->getHighestSet();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// bluff - call
|
|
||||||
if(bluff >= 98) {
|
|
||||||
// All In
|
|
||||||
if(actualHand->getPreflop()->getHighestSet() >= myCash) {
|
|
||||||
|
|
||||||
mySet += myCash;
|
// cout << "nextID " << actualHand->getPlayerArray()[(myID+1)%5]->getMyID() << endl;
|
||||||
myCash = 0;
|
|
||||||
myAction = 6;
|
Tools myTool;
|
||||||
|
int raise = 0;
|
||||||
}
|
|
||||||
// sonst
|
// Bauchgefhl (zufï¿Ålig)
|
||||||
else {
|
int tempRand;
|
||||||
myCash = myCash - actualHand->getPreflop()->getHighestSet() + mySet;
|
myTool.getRandNumber(1,10,1,&tempRand,0);
|
||||||
mySet = actualHand->getPreflop()->getHighestSet();
|
|
||||||
myAction = 3;
|
// bluff, checkbluff
|
||||||
}
|
int bluff;
|
||||||
} else {
|
myTool.getRandNumber(1,100,1,&bluff,0);
|
||||||
// doch nich raisen, sondern nur checken, weil highestSets bereits sehr hoch !!!
|
|
||||||
if(! (4 * actualHand->getSmallBlind() > actualHand->getPreflop()->getHighestSet())) {
|
// cout << "preflop-bluff " << bluff << endl;
|
||||||
|
|
||||||
// All In
|
// Potential
|
||||||
if(actualHand->getPreflop()->getHighestSet() >= myCash) {
|
int potential = 10*(4*(myCardsValue->holeCardsClass(myCards[0], myCards[1]))+1*tempRand)/50-myDude;
|
||||||
|
|
||||||
mySet += myCash;
|
int setToHighest = actualHand->getPreflop()->getHighestSet() - mySet;
|
||||||
myCash = 0;
|
|
||||||
myAction = 6;
|
// temp fr das Vielfache des Small Blind, sodass HighestSet zu hoch ist
|
||||||
|
int tempFold;
|
||||||
}
|
// tempFold = (actualHand->getPlayerArray()[0]->getMyAverageSets())/(8*actualHand->getSmallBlind());
|
||||||
// sonst
|
myTool.getRandNumber(2,3,1,&tempFold,0);
|
||||||
else {
|
|
||||||
myCash = myCash - actualHand->getPreflop()->getHighestSet() + mySet;
|
// FOLD --> wenn Potential negativ oder HighestSet zu hoch
|
||||||
mySet = actualHand->getPreflop()->getHighestSet();
|
if( (potential*setToHighest<0 || (setToHighest > tempFold * actualHand->getSmallBlind() && potential<1) || (setToHighest > 2 * tempFold * actualHand->getSmallBlind() && potential<2) || (setToHighest > 4 * tempFold * actualHand->getSmallBlind() && potential<3) || (setToHighest > 10 * tempFold * actualHand->getSmallBlind() && potential<4)) && myCardsValue->holeCardsClass(myCards[0], myCards[1]) < 9 && bluff > 15) {
|
||||||
myAction = 3;
|
myAction=1;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
}
|
// RAISE --> wenn hohes Potential
|
||||||
else raise = (potential - 4 ) * 2 * actualHand->getPreflop()->getHighestSet();
|
if(potential >= 4 && 6 * actualHand->getSmallBlind() >= actualHand->getPreflop()->getHighestSet() || bluff <= 6) {
|
||||||
}
|
// extrem hohes Potential --> groï¿År Raise
|
||||||
}
|
if(potential>=6 || bluff <= 2) {
|
||||||
}
|
|
||||||
// hohes Potential --> gemäßigter Raise
|
// bluff - raise
|
||||||
else {
|
if(bluff <=2 && 4 * actualHand->getSmallBlind() > actualHand->getPreflop()->getHighestSet()) {
|
||||||
// bluff - raise
|
raise = 3 * actualHand->getPreflop()->getHighestSet();
|
||||||
if(bluff <= 6 && 4 * actualHand->getSmallBlind() > actualHand->getPreflop()->getHighestSet()) {
|
|
||||||
raise = 2*actualHand->getPreflop()->getHighestSet();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// bluff - call
|
|
||||||
if(bluff >= 93) {
|
|
||||||
|
|
||||||
// All In
|
|
||||||
if(actualHand->getPreflop()->getHighestSet() >= myCash) {
|
|
||||||
|
|
||||||
mySet += myCash;
|
|
||||||
myCash = 0;
|
|
||||||
myAction = 6;
|
|
||||||
|
|
||||||
}
|
|
||||||
// sonst
|
|
||||||
else {
|
|
||||||
myCash = myCash - actualHand->getPreflop()->getHighestSet() + mySet;
|
|
||||||
mySet = actualHand->getPreflop()->getHighestSet();
|
|
||||||
myAction = 3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// doch nich raisen, sondern nur checken, weil highestSets bereits sehr hoch !!!
|
// bluff - call
|
||||||
if(! (4 * actualHand->getSmallBlind() > actualHand->getPreflop()->getHighestSet())) {
|
if(bluff >= 98) {
|
||||||
|
// All In
|
||||||
|
if(actualHand->getPreflop()->getHighestSet() >= myCash) {
|
||||||
|
|
||||||
|
mySet += myCash;
|
||||||
|
myCash = 0;
|
||||||
|
myAction = 6;
|
||||||
|
|
||||||
|
}
|
||||||
|
// sonst
|
||||||
|
else {
|
||||||
|
myCash = myCash - actualHand->getPreflop()->getHighestSet() + mySet;
|
||||||
|
mySet = actualHand->getPreflop()->getHighestSet();
|
||||||
|
myAction = 3;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// doch nich raisen, sondern nur checken, weil highestSets bereits sehr hoch !!!
|
||||||
|
if(! (4 * actualHand->getSmallBlind() > actualHand->getPreflop()->getHighestSet())) {
|
||||||
|
|
||||||
|
// All In
|
||||||
|
if(actualHand->getPreflop()->getHighestSet() >= myCash) {
|
||||||
|
|
||||||
|
mySet += myCash;
|
||||||
|
myCash = 0;
|
||||||
|
myAction = 6;
|
||||||
|
|
||||||
|
}
|
||||||
|
// sonst
|
||||||
|
else {
|
||||||
|
myCash = myCash - actualHand->getPreflop()->getHighestSet() + mySet;
|
||||||
|
mySet = actualHand->getPreflop()->getHighestSet();
|
||||||
|
myAction = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else raise = (potential - 4 ) * 2 * actualHand->getPreflop()->getHighestSet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// hohes Potential --> gemäßigter Raise
|
||||||
|
else {
|
||||||
|
// bluff - raise
|
||||||
|
if(bluff <= 6 && 4 * actualHand->getSmallBlind() > actualHand->getPreflop()->getHighestSet()) {
|
||||||
|
raise = 2*actualHand->getPreflop()->getHighestSet();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// bluff - call
|
||||||
|
if(bluff >= 93) {
|
||||||
|
|
||||||
// All In
|
// All In
|
||||||
if(actualHand->getPreflop()->getHighestSet() >= myCash) {
|
if(actualHand->getPreflop()->getHighestSet() >= myCash) {
|
||||||
|
|
||||||
@@ -303,57 +226,263 @@ void LocalPlayer::preflopEngine() {
|
|||||||
myAction = 3;
|
myAction = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else raise = (potential - 3 ) * actualHand->getPreflop()->getHighestSet();
|
else {
|
||||||
|
// doch nich raisen, sondern nur checken, weil highestSets bereits sehr hoch !!!
|
||||||
|
if(! (4 * actualHand->getSmallBlind() > actualHand->getPreflop()->getHighestSet())) {
|
||||||
|
|
||||||
|
// All In
|
||||||
|
if(actualHand->getPreflop()->getHighestSet() >= myCash) {
|
||||||
|
|
||||||
|
mySet += myCash;
|
||||||
|
myCash = 0;
|
||||||
|
myAction = 6;
|
||||||
|
|
||||||
|
}
|
||||||
|
// sonst
|
||||||
|
else {
|
||||||
|
myCash = myCash - actualHand->getPreflop()->getHighestSet() + mySet;
|
||||||
|
mySet = actualHand->getPreflop()->getHighestSet();
|
||||||
|
myAction = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else raise = (potential - 3 ) * actualHand->getPreflop()->getHighestSet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (raise > 0) {
|
||||||
|
// All In
|
||||||
|
if(actualHand->getPreflop()->getHighestSet() + raise >= myCash) {
|
||||||
|
|
||||||
|
mySet += myCash;
|
||||||
|
myCash = 0;
|
||||||
|
myAction = 6;
|
||||||
|
if(mySet > actualHand->getPreflop()->getHighestSet()) actualHand->getPreflop()->setHighestSet(mySet);
|
||||||
|
|
||||||
|
}
|
||||||
|
// sonst
|
||||||
|
else {
|
||||||
|
|
||||||
|
myCash = myCash + mySet - actualHand->getPreflop()->getHighestSet() - raise;
|
||||||
|
mySet = actualHand->getPreflop()->getHighestSet() + raise;
|
||||||
|
actualHand->getPreflop()->setHighestSet(mySet);
|
||||||
|
myAction = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//CHECK und CALL
|
||||||
|
else {
|
||||||
|
// CHECK --> wenn alle Sets glieich bei BigBlind und nich zu hohem Potential
|
||||||
|
if(mySet == actualHand->getPreflop()->getHighestSet()) {
|
||||||
|
myAction = 2;
|
||||||
|
}
|
||||||
|
// CALL --> bei normalen Potential
|
||||||
|
else {
|
||||||
|
// All In
|
||||||
|
if(actualHand->getPreflop()->getHighestSet() >= myCash) {
|
||||||
|
|
||||||
if (raise > 0) {
|
mySet += myCash;
|
||||||
// All In
|
myCash = 0;
|
||||||
if(actualHand->getPreflop()->getHighestSet() + raise >= myCash) {
|
myAction = 6;
|
||||||
|
|
||||||
|
}
|
||||||
|
// sonst
|
||||||
|
else {
|
||||||
|
myCash = myCash - actualHand->getPreflop()->getHighestSet() + mySet;
|
||||||
|
mySet = actualHand->getPreflop()->getHighestSet();
|
||||||
|
myAction = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// ############# ENGINE 0.4 ##################
|
||||||
|
else {
|
||||||
|
// cout << "Engine 0.4" << endl;
|
||||||
|
|
||||||
|
// Code der HoleCards ermitteln
|
||||||
|
int handCode;
|
||||||
|
if(myCards[0]%13 == myCards[1]%13) {
|
||||||
|
handCode = (myCards[0]%13)*1000 + (myCards[0]%13)*10;
|
||||||
|
} else {
|
||||||
|
if(myCards[0]%13 < myCards[1]%13) {
|
||||||
|
if(myCards[0]/13 == myCards[1]/13) {
|
||||||
|
handCode = (myCards[0]%13)*1000 + (myCards[1]%13)*10 + 1;
|
||||||
|
} else {
|
||||||
|
handCode = (myCards[0]%13)*1000 + (myCards[1]%13)*10;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(myCards[0]/13 == myCards[1]/13) {
|
||||||
|
handCode = (myCards[1]%13)*1000 + (myCards[0]%13)*10 + 1;
|
||||||
|
} else {
|
||||||
|
handCode = (myCards[1]%13)*1000 + (myCards[0]%13)*10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string fileName = myConfig.readConfigString("DataDir")+"preflopValues";
|
||||||
|
|
||||||
|
ifstream fin;
|
||||||
|
|
||||||
|
fin.open(fileName.c_str());
|
||||||
|
if(!fin) {
|
||||||
|
cout << "Es ist nicht möglich " << fileName << " zum lesen zu oeffnen." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
char buffer[50];
|
||||||
|
char hand[6];
|
||||||
|
hand[5] = '\0';
|
||||||
|
int i,j,k;
|
||||||
|
char preflopValue[8];
|
||||||
|
myHoleCardsValue = -1.;
|
||||||
|
while(fin.getline(buffer,50)) {
|
||||||
|
for(i=0; i<5; i++) hand[i] = buffer[i];
|
||||||
|
if(handCode == atoi(hand)) {
|
||||||
|
j = 0;
|
||||||
|
k = 2;
|
||||||
|
while(buffer[j] != '|' || k < actualHand->getActualQuantityPlayers()) {
|
||||||
|
if(buffer[j] == '|') k++;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
for(k=0; k<8 ; k++) preflopValue[k] = buffer[k+j+1];
|
||||||
|
myHoleCardsValue = 100*atof(preflopValue);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fin.close();
|
||||||
|
if(myHoleCardsValue == -1) cout << "ERROR myHoleCardsValue - " << handCode << endl;
|
||||||
|
|
||||||
|
int raise = 0;
|
||||||
|
|
||||||
|
// Niveaus setzen + Dude + Anzahl Gegenspieler
|
||||||
|
// 1. Fold -- Call
|
||||||
|
myNiveau[0] = 40 + myDude4 - 6*(actualHand->getActualQuantityPlayers() - 2);
|
||||||
|
// 2. Check -- Bet
|
||||||
|
myNiveau[1] = 50;
|
||||||
|
// 3. Call -- Raise
|
||||||
|
myNiveau[2] = 53 + myDude4 - 6*(actualHand->getActualQuantityPlayers() - 2);
|
||||||
|
|
||||||
|
// Verhaeltnis Set / Cash
|
||||||
|
if(myCash/actualHand->getPreflop()->getHighestSet() >= 25) {
|
||||||
|
myNiveau[0] += (25-myCash/actualHand->getPreflop()->getHighestSet())/10;
|
||||||
|
} else {
|
||||||
|
myNiveau[0] += (25-myCash/actualHand->getPreflop()->getHighestSet())/3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// auf Aggresivität des humanPlayers eingehen
|
||||||
|
int aggValue = ( (50*(actualHand->getPlayerArray()[0]->getMyAverageSets()-6*actualHand->getSmallBlind())) / (actualHand->getStartQuantityPlayers()*actualHand->getStartCash() - 6*actualHand->getSmallBlind()) );
|
||||||
|
|
||||||
|
if(aggValue > 0) {
|
||||||
|
myNiveau[0] -= aggValue;
|
||||||
|
myNiveau[2] -= aggValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cout << "Spieler " << myID << ": Dude " << myDude4 << "\t Wert " << myHoleCardsValue << "\t Niveau " << myNiveau[0] << " " << myNiveau[1] << " " << myNiveau[2] << "\t Agg " << aggValue << " " << endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// aktive oder passivie Situation ? -> im preflop nur passiv
|
||||||
|
|
||||||
|
// raise (bei hohem Niveau)
|
||||||
|
if(myHoleCardsValue >= myNiveau[2]) {
|
||||||
|
|
||||||
|
// raise-loop unterbinden -> d.h. entweder call oder bei superblatt all in
|
||||||
|
if(actualHand->getPreflop()->getHighestSet() >= 12*actualHand->getSmallBlind()) {
|
||||||
|
// all in
|
||||||
|
if(myHoleCardsValue >= myNiveau[2] + 8) {
|
||||||
|
raise = myCash;
|
||||||
|
myAction = 5;
|
||||||
|
}
|
||||||
|
// nur call
|
||||||
|
else {
|
||||||
|
myAction = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Standard-Raise-Routine
|
||||||
|
} else {
|
||||||
|
// raise-Betrag ermitteln
|
||||||
|
raise = (((int)myHoleCardsValue-myNiveau[2])/2)*2*actualHand->getSmallBlind();
|
||||||
|
// raise-Betrag zu klein -> mindestens Standard-raise
|
||||||
|
if(raise == 0) {
|
||||||
|
raise = actualHand->getPreflop()->getHighestSet()-mySet;
|
||||||
|
}
|
||||||
|
myAction = 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// call
|
||||||
|
if(myHoleCardsValue >= myNiveau[0] || (mySet >= actualHand->getPreflop()->getHighestSet()/2 && myHoleCardsValue >= myNiveau[0]-5)) {
|
||||||
|
// bigBlind --> check
|
||||||
|
if(myButton == 3 && mySet == actualHand->getPreflop()->getHighestSet()) myAction = 2;
|
||||||
|
else myAction = 3;
|
||||||
|
}
|
||||||
|
// fold
|
||||||
|
else {
|
||||||
|
// bigBlind -> check
|
||||||
|
if(myButton == 3 && mySet == actualHand->getPreflop()->getHighestSet()) myAction = 2;
|
||||||
|
else myAction = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auswertung
|
||||||
|
|
||||||
|
switch(myAction) {
|
||||||
|
// none
|
||||||
|
case 0: {}
|
||||||
|
break;
|
||||||
|
// fold
|
||||||
|
case 1: {}
|
||||||
|
break;
|
||||||
|
// check
|
||||||
|
case 2: {}
|
||||||
|
break;
|
||||||
|
// call
|
||||||
|
case 3: {
|
||||||
|
// all in
|
||||||
|
if(actualHand->getPreflop()->getHighestSet() >= myCash) {
|
||||||
|
|
||||||
|
mySet += myCash;
|
||||||
|
myCash = 0;
|
||||||
|
myAction = 6;
|
||||||
|
|
||||||
|
}
|
||||||
|
// sonst
|
||||||
|
else {
|
||||||
|
myCash = myCash - actualHand->getPreflop()->getHighestSet() + mySet;
|
||||||
|
mySet = actualHand->getPreflop()->getHighestSet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// bet
|
||||||
|
case 4: {}
|
||||||
|
break;
|
||||||
|
// raise
|
||||||
|
case 5: {
|
||||||
|
// all in
|
||||||
|
if(actualHand->getPreflop()->getHighestSet() + raise >= myCash) {
|
||||||
mySet += myCash;
|
mySet += myCash;
|
||||||
myCash = 0;
|
myCash = 0;
|
||||||
myAction = 6;
|
myAction = 6;
|
||||||
if(mySet > actualHand->getPreflop()->getHighestSet()) actualHand->getPreflop()->setHighestSet(mySet);
|
if(mySet > actualHand->getPreflop()->getHighestSet()) actualHand->getPreflop()->setHighestSet(mySet);
|
||||||
|
|
||||||
}
|
}
|
||||||
// sonst
|
// sonst
|
||||||
else {
|
else {
|
||||||
|
|
||||||
myCash = myCash + mySet - actualHand->getPreflop()->getHighestSet() - raise;
|
myCash = myCash + mySet - actualHand->getPreflop()->getHighestSet() - raise;
|
||||||
mySet = actualHand->getPreflop()->getHighestSet() + raise;
|
mySet = actualHand->getPreflop()->getHighestSet() + raise;
|
||||||
actualHand->getPreflop()->setHighestSet(mySet);
|
actualHand->getPreflop()->setHighestSet(mySet);
|
||||||
myAction = 5;
|
myAction = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
// all in
|
||||||
|
case 6: {}
|
||||||
|
break;
|
||||||
|
default: {}
|
||||||
}
|
}
|
||||||
//CHECK und CALL
|
|
||||||
else {
|
|
||||||
// CHECK --> wenn alle Sets glieich bei BigBlind und nich zu hohem Potential
|
|
||||||
if(mySet == actualHand->getPreflop()->getHighestSet()) {
|
|
||||||
myAction = 2;
|
|
||||||
}
|
|
||||||
// CALL --> bei normalen Potential
|
|
||||||
else {
|
|
||||||
// All In
|
|
||||||
if(actualHand->getPreflop()->getHighestSet() >= myCash) {
|
|
||||||
|
|
||||||
mySet += myCash;
|
|
||||||
myCash = 0;
|
|
||||||
myAction = 6;
|
|
||||||
|
|
||||||
}
|
|
||||||
// sonst
|
|
||||||
else {
|
|
||||||
myCash = myCash - actualHand->getPreflop()->getHighestSet() + mySet;
|
|
||||||
mySet = actualHand->getPreflop()->getHighestSet();
|
|
||||||
myAction = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::flopEngine() {
|
void LocalPlayer::flopEngine() {
|
||||||
|
|||||||
@@ -84,8 +84,8 @@ public:
|
|||||||
void setMyRoundStartCash(const int& theValue) { myRoundStartCash = theValue;}
|
void setMyRoundStartCash(const int& theValue) { myRoundStartCash = theValue;}
|
||||||
int getMyRoundStartCash() const { return myRoundStartCash; }
|
int getMyRoundStartCash() const { return myRoundStartCash; }
|
||||||
|
|
||||||
void setMyAverageSets(const int& theValue) { myAverageSets = theValue; }
|
void setMyAverageSets(const int& theValue) { myAverageSets[0] = myAverageSets[1]; myAverageSets[1] = myAverageSets[2]; myAverageSets[2] = myAverageSets[3]; myAverageSets[3] = theValue; }
|
||||||
int getMyAverageSets() const { return myAverageSets; }
|
int getMyAverageSets() const { return (myAverageSets[0]+myAverageSets[1]+myAverageSets[2]+myAverageSets[3])/4; }
|
||||||
|
|
||||||
void action();
|
void action();
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ private:
|
|||||||
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
|
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
|
||||||
int myRoundStartCash;
|
int myRoundStartCash;
|
||||||
|
|
||||||
int myAverageSets;
|
int myAverageSets[4];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public:
|
|||||||
void nextPlayer2();
|
void nextPlayer2();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HandInterface *myHand;
|
HandInterface *myHand;
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,11 @@ void LocalRiver::riverRun() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// River ist wirklich dran
|
// River ist wirklich dran
|
||||||
|
|
||||||
|
// Anzahl der effektiv gespielten Runden (des human player) erhöhen
|
||||||
|
if(myHand->getPlayerArray()[0]->getMyActiveStatus() && myHand->getPlayerArray()[0]->getMyAction() != 1) {
|
||||||
|
myHand->setBettingRoundsPlayed(3);
|
||||||
|
}
|
||||||
|
|
||||||
// nᅵhsten Spieler ermitteln
|
// nᅵhsten Spieler ermitteln
|
||||||
do { playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers());
|
do { playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers());
|
||||||
@@ -120,12 +125,12 @@ void LocalRiver::postRiverRun() {
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// für die Engine die durchschnittlichen Sets von Player 0 setzen
|
// für die Engine die durchschnittlichen Sets von Player 0 setzen --> UNUSED !!!
|
||||||
if(myID < 5) {
|
// if(myID < 5) {
|
||||||
myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyAverageSets())*(myID-1))/myID + (myHand->getPlayerArray()[0]->getMyRoundStartCash()-myHand->getPlayerArray()[0]->getMyCash())/myID);
|
// myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyAverageSets())*(myID-1))/myID + (myHand->getPlayerArray()[0]->getMyRoundStartCash()-myHand->getPlayerArray()[0]->getMyCash())/myID);
|
||||||
} else {
|
// } else {
|
||||||
myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyAverageSets())*4)/5 + (myHand->getPlayerArray()[0]->getMyRoundStartCash()-myHand->getPlayerArray()[0]->getMyCash())/5);
|
// myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyAverageSets())*4)/5 + (myHand->getPlayerArray()[0]->getMyRoundStartCash()-myHand->getPlayerArray()[0]->getMyCash())/5);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// cout << myHand->getPlayerArray()[0]->getMyAverageSets() << endl;
|
// cout << myHand->getPlayerArray()[0]->getMyAverageSets() << endl;
|
||||||
|
|
||||||
@@ -139,6 +144,10 @@ void LocalRiver::postRiverRun() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggresivität des human player ermitteln
|
||||||
|
myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyRoundStartCash())-(myHand->getPlayerArray()[0]->getMyCash()))/(myHand->getBettingRoundsPlayed()+1));
|
||||||
|
// cout << myHand->getPlayerArray()[0]->getMyAverageSets() << endl;
|
||||||
|
|
||||||
// Pot-Verteilung
|
// Pot-Verteilung
|
||||||
distributePot();
|
distributePot();
|
||||||
|
|
||||||
@@ -423,4 +432,6 @@ void LocalRiver::distributePot() {
|
|||||||
delete[] winnersArray;
|
delete[] winnersArray;
|
||||||
delete[] roundSetArray;
|
delete[] roundSetArray;
|
||||||
delete[] cardsValueArray;
|
delete[] cardsValueArray;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,11 @@ void LocalTurn::turnRun() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Turn ist wirklich dran
|
// Turn ist wirklich dran
|
||||||
|
|
||||||
|
// Anzahl der effektiv gespielten Runden (des human player) erhöhen
|
||||||
|
if(myHand->getPlayerArray()[0]->getMyActiveStatus() && myHand->getPlayerArray()[0]->getMyAction() != 1) {
|
||||||
|
myHand->setBettingRoundsPlayed(2);
|
||||||
|
}
|
||||||
|
|
||||||
// n�hsten Spieler ermitteln
|
// n�hsten Spieler ermitteln
|
||||||
do { playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers());
|
do { playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers());
|
||||||
|
|||||||
@@ -1332,7 +1332,7 @@ void mainWindowImpl::myRaise(){
|
|||||||
default: {}
|
default: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
spinBox_set->setMinimum(tempHighestSet*2 - actualHand->getPlayerArray()[0]->getMySet());
|
spinBox_set->setMinimum(tempHighestSet*2 - actualHand->getPlayerArray()[0]->getMySet());
|
||||||
spinBox_set->setMaximum(actualHand->getPlayerArray()[0]->getMyCash());
|
spinBox_set->setMaximum(actualHand->getPlayerArray()[0]->getMyCash());
|
||||||
spinBox_set->setValue(spinBox_set->minimum());
|
spinBox_set->setValue(spinBox_set->minimum());
|
||||||
spinBox_set->setFocus();
|
spinBox_set->setFocus();
|
||||||
|
|||||||
Reference in New Issue
Block a user