From b79c60e2460c8f70b76199fd536c41aeba9d6a18 Mon Sep 17 00:00:00 2001 From: floty Date: Thu, 12 Jun 2014 02:24:59 +0200 Subject: [PATCH] complete integration of new cards value function with an additional auxiliary function; renaming some variables; comment old code --- src/engine/local_engine/cardsvalue.cpp | 62 +- src/engine/local_engine/cardsvalue.h | 3 +- src/engine/local_engine/localbero.cpp | 12 +- src/engine/local_engine/localhand.cpp | 61 +- src/engine/local_engine/localplayer.cpp | 1475 +++++++++++------------ src/engine/local_engine/localplayer.h | 8 +- src/engine/log.cpp | 8 +- src/gui/qt/gametable/gametableimpl.cpp | 40 +- 8 files changed, 830 insertions(+), 839 deletions(-) diff --git a/src/engine/local_engine/cardsvalue.cpp b/src/engine/local_engine/cardsvalue.cpp index cf87822e..4051e453 100755 --- a/src/engine/local_engine/cardsvalue.cpp +++ b/src/engine/local_engine/cardsvalue.cpp @@ -636,7 +636,7 @@ int CardsValue::cardsValueOld(int cards[7], int position[5]) // Karten fr den Vierling-, Full-House-, Drilling- und Paartest umsortieren for(k1=0; k1<7; k1++) { for(k2=k1+1; k2<7; k2++) { - if(array[k1][1] > calcCardsChance(GameState, int[2], int[5]); static int bitcount(int in); + static int bestHandToPosition(int bestHand[4], int cardArray[7], int position[5]); //static int** showdown(GameState, int**, int); }; diff --git a/src/engine/local_engine/localbero.cpp b/src/engine/local_engine/localbero.cpp index 3e9e031a..6bb7eb85 100644 --- a/src/engine/local_engine/localbero.cpp +++ b/src/engine/local_engine/localbero.cpp @@ -147,26 +147,26 @@ void LocalBeRo::run() //log the turned cards if(!logBoardCardsDone) { - int tempBoardCardsArray[5]; + int boardCards[5]; - myHand->getBoard()->getMyCards(tempBoardCardsArray); + myHand->getBoard()->getMyCards(boardCards); switch(myBeRoID) { case GAME_STATE_FLOP: - myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2]); + myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, boardCards[0], boardCards[1], boardCards[2]); break; case GAME_STATE_TURN: - myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3]); + myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, boardCards[0], boardCards[1], boardCards[2], boardCards[3]); break; case GAME_STATE_RIVER: - myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]); + myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, boardCards[0], boardCards[1], boardCards[2], boardCards[3], boardCards[4]); break; default: { LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR - wrong myBeRoID"); } } - if(myHand->getLog()) myHand->getLog()->logBoardCards(tempBoardCardsArray); + if(myHand->getLog()) myHand->getLog()->logBoardCards(boardCards); logBoardCardsDone = true; } diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index f54d61ef..9ac7922b 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -58,7 +58,7 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, boost: // generate cards and assign to board and player const int NumCards = 52; - int cardsArray[NumCards] = { + int cards[NumCards] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, @@ -66,49 +66,50 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, boost: 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 }; - Tools::ShuffleArrayNonDeterministic(cardsArray, NumCards); - int tempBoardArray[5]; - int tempPlayerArray[2]; - int tempPlayerAndBoardArray[7]; - int bestHandPos[5]; + Tools::ShuffleArrayNonDeterministic(cards, NumCards); + int boardCards[5]; + int playerHoleCards[2]; + int playerCards[7]; int sBluff; // board cards - for(i=0; i<5; i++) tempBoardArray[i] = cardsArray[i]; + for(i=0; i<5; i++) boardCards[i] = cards[i]; // debug mode - if(myLog) myLog->debugMode_getBoardCards(tempBoardArray,myID); + if(myLog) myLog->debugMode_getBoardCards(boardCards,myID); // prepare whole player hand - for(i=0; i<5; i++) tempPlayerAndBoardArray[i+2] = tempBoardArray[i]; + for(i=0; i<5; i++) playerCards[i+2] = boardCards[i]; k = 0; - myBoard->setMyCards(tempBoardArray); + myBoard->setMyCards(boardCards); for(it=activePlayerList->begin(); it!=activePlayerList->end(); ++it, k++) { - (*it)->getMyBestHandPosition(bestHandPos); - // hole cards - for(j=0; j<2; j++) tempPlayerArray[j] = cardsArray[2*k+j+5]; - - // debug mode - if(myLog) myLog->debugMode_getPlayerCards(tempPlayerArray,myID,k); + for(j=0; j<2; j++) playerHoleCards[j] = cards[2*k+j+5]; + (*it)->setMyHoleCards(playerHoleCards); + if(myLog) myLog->debugMode_getPlayerCards(playerHoleCards,myID,k); // debug mode // complete whole player hand - for(j=0; j<2; j++) tempPlayerAndBoardArray[j] = tempPlayerArray[j]; + for(j=0; j<2; j++) playerCards[j] = playerHoleCards[j]; - (*it)->setMyHoleCards(tempPlayerArray); - (*it)->setMyCardsValueInt(CardsValue::cardsValueOld(tempPlayerAndBoardArray, bestHandPos)); - (*it)->setMyBestHandPosition(bestHandPos); - (*it)->setMyRoundStartCash((*it)->getMyCash()); + // determine cards value + int bestHand[4] = { 0,0,0,0 }; + int playerCardsColor[4] = { 0,0,0,0 }; + for(j=0; j<7; j++) playerCardsColor[playerCards[j]/13] |= (1 << playerCards[j]%13); + (*it)->setMyCardsValueInt(CardsValue::cardsValue(playerCardsColor,bestHand)); - // error-check - for(j=0; j<5; j++) { - if (bestHandPos[j] == -1) { - LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR getMyBestHandPosition"); - } + // determine position of best 5 cards + int bestHandPos[5]; + if(CardsValue::bestHandToPosition(bestHand,playerCards,bestHandPos)) { + (*it)->setMyBestHandPosition(bestHandPos); + } else { + LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR getMyBestHandPosition"); } + // set round start cash + (*it)->setMyRoundStartCash((*it)->getMyCash()); + // set sBluff for all players --> TODO for ai-player in internet if((*it)->getMyID() != 0) { Tools::GetRand(1, 100, 1, &sBluff); @@ -394,11 +395,11 @@ void LocalHand::switchRounds() //log board cards for allin if(currentRound >= GAME_STATE_FLOP) { - int tempBoardCardsArray[5]; + int boardCards[5]; - myBoard->getMyCards(tempBoardCardsArray); - myGui->logDealBoardCardsMsg(currentRound, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]); - if(myLog) myLog->logBoardCards(tempBoardCardsArray); + myBoard->getMyCards(boardCards); + myGui->logDealBoardCardsMsg(currentRound, boardCards[0], boardCards[1], boardCards[2], boardCards[3], boardCards[4]); + if(myLog) myLog->logBoardCards(boardCards); } } diff --git a/src/engine/local_engine/localplayer.cpp b/src/engine/local_engine/localplayer.cpp index 15ebafd0..8f0dfadc 100755 --- a/src/engine/local_engine/localplayer.cpp +++ b/src/engine/local_engine/localplayer.cpp @@ -920,8 +920,8 @@ void LocalPlayer::action() switch(currentHand->getCurrentRound()) { case 0: { - if(myConfig->readConfigInt("EngineVersion")) preflopEngine3(); - else preflopEngine(); + /*if(myConfig->readConfigInt("EngineVersion")) preflopEngine3(); + else */preflopEngine(); currentHand->getBoard()->collectSets(); currentHand->getGuiInterface()->refreshPot(); @@ -930,8 +930,8 @@ void LocalPlayer::action() break; case 1: { - if(myConfig->readConfigInt("EngineVersion")) flopEngine3(); - else flopEngine(); + /*if(myConfig->readConfigInt("EngineVersion")) flopEngine3(); + else */flopEngine(); currentHand->getBoard()->collectSets(); currentHand->getGuiInterface()->refreshPot(); @@ -940,8 +940,8 @@ void LocalPlayer::action() break; case 2: { - if(myConfig->readConfigInt("EngineVersion")) turnEngine3(); - else turnEngine(); + /*if(myConfig->readConfigInt("EngineVersion")) turnEngine3(); + else */turnEngine(); currentHand->getBoard()->collectSets(); currentHand->getGuiInterface()->refreshPot(); @@ -950,8 +950,8 @@ void LocalPlayer::action() break; case 3: { - if(myConfig->readConfigInt("EngineVersion")) riverEngine3(); - else riverEngine(); + /*if(myConfig->readConfigInt("EngineVersion")) riverEngine3(); + else */riverEngine(); currentHand->getBoard()->collectSets(); currentHand->getGuiInterface()->refreshPot(); @@ -2852,12 +2852,8 @@ void LocalPlayer::calcMyOdds() currentHand->getBoard()->getMyCards(boardCards); for(i=0; i<3; i++) tempArray[2+i] = boardCards[i]; - // cout << myID << ": "; - handCode = flopCardsValue(tempArray); - // cout << "\t" << handCode << endl; - // übergang solange preflopValue und flopValue noch nicht bereinigt int players = currentHand->getActivePlayerList()->size(); if(players > 5) players = 5; @@ -2876,9 +2872,6 @@ void LocalPlayer::calcMyOdds() logger << "ERROR myOdds is -1: "; for(i=0; i<5; i++) logger << tempArray[i] << " "; LOG_ERROR(__FILE__ << " (" << __LINE__ << "): " << logger.str()); - // cout << "\t" << handCode << "\t" << myID << endl; - } else { - // cout << myHoleCardsValue << endl; } } else { myOdds = 100; @@ -2888,57 +2881,41 @@ void LocalPlayer::calcMyOdds() break; case GAME_STATE_TURN: { - int i, j, k; - int tempBoardCardsArray[5]; - int tempMyCardsArray[7]; - int tempOpponentCardsArray[7]; - currentHand->getBoard()->getMyCards(tempBoardCardsArray); + int boardCards[5]; + currentHand->getBoard()->getMyCards(boardCards); - tempMyCardsArray[0] = myHoleCards[0]; - tempMyCardsArray[1] = myHoleCards[1]; - tempMyCardsArray[2] = tempBoardCardsArray[0]; - tempMyCardsArray[3] = tempBoardCardsArray[1]; - tempMyCardsArray[4] = tempBoardCardsArray[2]; - tempMyCardsArray[5] = tempBoardCardsArray[3]; - - tempOpponentCardsArray[2] = tempBoardCardsArray[0]; - tempOpponentCardsArray[3] = tempBoardCardsArray[1]; - tempOpponentCardsArray[4] = tempBoardCardsArray[2]; - tempOpponentCardsArray[5] = tempBoardCardsArray[3]; - - - -// int myCards[4] = { 0,0,0,0 }; -// int opponentCards[4] = { 0,0,0,0 }; - - - int tempMyCardsValue; - int tempOpponentCardsValue; + int card_idx_1; + int myCards[4] = { 0,0,0,0 }; + int opponentCards[4] = { 0,0,0,0 }; + for(card_idx_1=0; card_idx_1<4; card_idx_1++) myCards[boardCards[card_idx_1]/13] |= (1 << (boardCards[card_idx_1]%13)); + std::copy(myCards,myCards+4,opponentCards); + for(card_idx_1=0; card_idx_1<2; card_idx_1++) myCards[myHoleCards[card_idx_1]/13] |= (1 << (myHoleCards[card_idx_1]%13)); int countAll = 0; int countMy = 0; - for(i=0; i<49; i++) { - if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) { - for(j=i+1; j<50; j++) { - if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) { - for(k=j+1; k<51; k++) { - if(k != myHoleCards[0] && k != myHoleCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) { + for(card_idx_1=0; card_idx_1<52; card_idx_1++) { + if( (myCards[card_idx_1/13] & (1 << (card_idx_1%13)))==0 ) { + myCards[card_idx_1/13] |= (1<< (card_idx_1%13)); + opponentCards[card_idx_1/13] |= (1<< (card_idx_1%13)); + for(int card_idx_2=0; card_idx_2<51; card_idx_2++) { + if( (myCards[card_idx_2/13] & (1 << (card_idx_2%13)))==0 ) { + opponentCards[card_idx_2/13] |= (1<< (card_idx_2%13)); + for(int card_idx_3=card_idx_2+1; card_idx_3<52; card_idx_3++) { + if( (myCards[card_idx_3/13] & (1 << (card_idx_3%13)))==0 ) { + opponentCards[card_idx_3/13] |= (1<< (card_idx_3%13)); countAll++; + if(CardsValue::cardsValue(myCards)>=CardsValue::cardsValue(opponentCards)) countMy++; - tempOpponentCardsArray[0] = i; - tempOpponentCardsArray[1] = j; - tempOpponentCardsArray[6] = k; - tempMyCardsArray[6] = k; - tempMyCardsValue = CardsValue::cardsValueOld(tempMyCardsArray,0); - tempOpponentCardsValue = CardsValue::cardsValueOld(tempOpponentCardsArray,0); - - if(tempMyCardsValue>=tempOpponentCardsValue) countMy++; + opponentCards[card_idx_3/13] &= ~(1<< (card_idx_3%13)); } } + opponentCards[card_idx_2/13] &= ~(1<< (card_idx_2%13)); } } + myCards[card_idx_1/13] &= ~(1<< (card_idx_1%13)); + opponentCards[card_idx_1/13] &= ~(1<< (card_idx_1%13)); } } @@ -2948,49 +2925,33 @@ void LocalPlayer::calcMyOdds() break; case GAME_STATE_RIVER: { - // Prozent ausrechnen + int boardCards[5]; + currentHand->getBoard()->getMyCards(boardCards); - int i, j; - int tempBoardCardsArray[5]; - int tempMyCardsArray[7]; - int tempOpponentCardsArray[7]; - currentHand->getBoard()->getMyCards(tempBoardCardsArray); - - tempMyCardsArray[0] = myHoleCards[0]; - tempMyCardsArray[1] = myHoleCards[1]; - tempMyCardsArray[2] = tempBoardCardsArray[0]; - tempMyCardsArray[3] = tempBoardCardsArray[1]; - tempMyCardsArray[4] = tempBoardCardsArray[2]; - tempMyCardsArray[5] = tempBoardCardsArray[3]; - tempMyCardsArray[6] = tempBoardCardsArray[4]; - - tempOpponentCardsArray[2] = tempBoardCardsArray[0]; - tempOpponentCardsArray[3] = tempBoardCardsArray[1]; - tempOpponentCardsArray[4] = tempBoardCardsArray[2]; - tempOpponentCardsArray[5] = tempBoardCardsArray[3]; - tempOpponentCardsArray[6] = tempBoardCardsArray[4]; - - int tempMyCardsValue; - int tempOpponentCardsValue; + int card_idx_1; + int myCards[4] = { 0,0,0,0 }; + int opponentCards[4] = { 0,0,0,0 }; + for(card_idx_1=0; card_idx_1<5; card_idx_1++) myCards[boardCards[card_idx_1]/13] |= (1 << (boardCards[card_idx_1]%13)); + std::copy(myCards,myCards+4,opponentCards); + for(card_idx_1=0; card_idx_1<2; card_idx_1++) myCards[myHoleCards[card_idx_1]/13] |= (1 << (myHoleCards[card_idx_1]%13)); int countAll = 0; int countMy = 0; - for(i=0; i<49; i++) { - if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) { - for(j=i+1; j<50; j++) { - if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) { + for(card_idx_1=0; card_idx_1<51; card_idx_1++) { + if( (myCards[card_idx_1/13] & (1 << (card_idx_1%13)))==0 ) { + opponentCards[card_idx_1/13] |= (1<< (card_idx_1%13)); + for(int card_idx_2=card_idx_1+1; card_idx_2<52; card_idx_2++) { + if( (myCards[card_idx_2/13] & (1 << (card_idx_2%13)))==0 ) { + opponentCards[card_idx_2/13] |= (1<< (card_idx_2%13)); countAll++; + if(CardsValue::cardsValue(myCards)>=CardsValue::cardsValue(opponentCards)) countMy++; - tempOpponentCardsArray[0] = i; - tempOpponentCardsArray[1] = j; - tempMyCardsValue = CardsValue::cardsValueOld(tempMyCardsArray,0); - tempOpponentCardsValue = CardsValue::cardsValueOld(tempOpponentCardsArray,0); - - if(tempMyCardsValue>=tempOpponentCardsValue) countMy++; + opponentCards[card_idx_2/13] &= ~(1<< (card_idx_2%13)); } } + opponentCards[card_idx_1/13] &= ~(1<< (card_idx_1%13)); } } @@ -3264,676 +3225,676 @@ int LocalPlayer::turnCardsValue(int* cards) -void LocalPlayer::preflopEngine3() -{ - - // cout << "nextID " << currentHand->getPlayerArray()[(myID+1)%5]->getMyID() << endl; - - - // Bauchgefhl (zufᅵlig) - int tempRand; - Tools::GetRand(1, 10, 1, &tempRand); - - // bluff, checkbluff - int bluff; - Tools::GetRand(1, 100, 1, &bluff); - - // cout << "preflop-bluff " << bluff << endl; - - // Potential - int potential = 10*(4*(CardsValue::holeCardsClass(myHoleCards[0], myHoleCards[1]))+1*tempRand)/50-myDude; - - int setToHighest = currentHand->getCurrentBeRo()->getHighestSet() - mySet; - - // temp fr das Vielfache des Small Blind, sodass HighestSet zu hoch ist - int tempFold; - // tempFold = (currentHand->getPlayerArray()[0]->getMyAverageSets())/(8*currentHand->getSmallBlind()); - Tools::GetRand(2, 3, 1, &tempFold); - - // FOLD --> wenn Potential negativ oder HighestSet zu hoch - if( (potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 2 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 4 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 10 * tempFold * currentHand->getSmallBlind() && potential<4)) && CardsValue::holeCardsClass(myHoleCards[0], myHoleCards[1]) < 9 && bluff > 15) { - myAction = PLAYER_ACTION_FOLD; - } else { - // RAISE --> wenn hohes Potential - if((potential >= 4 && 6 * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet()) || bluff <= 6) { - int raise = 0; - // extrem hohes Potential --> groᅵr Raise - if(potential>=6 || bluff <= 2) { - - // bluff - raise - if(bluff <=2 && 4 * currentHand->getSmallBlind() > currentHand->getCurrentBeRo()->getHighestSet()) { - raise = 3 * currentHand->getCurrentBeRo()->getHighestSet(); - } else { - // bluff - call - if(bluff >= 98) { - // All In - if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { - - mySet += myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - - } - // sonst - else { - myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; - mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; - } - } else { - // doch nich raisen, sondern nur checken, weil highestSets bereits sehr hoch !!! - if(! (4 * currentHand->getSmallBlind() > currentHand->getCurrentBeRo()->getHighestSet())) { - - // All In - if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { - - mySet += myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - - } - // sonst - else { - myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; - mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; - } - - } else raise = (potential - 4 ) * 2 * currentHand->getCurrentBeRo()->getHighestSet(); - } - } - } - // hohes Potential --> gemäßigter Raise - else { - // bluff - raise - if(bluff <= 6 && 4 * currentHand->getSmallBlind() > currentHand->getCurrentBeRo()->getHighestSet()) { - raise = 2*currentHand->getCurrentBeRo()->getHighestSet(); - } else { - // bluff - call - if(bluff >= 93) { - - // All In - if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { - - mySet += myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - - } - // sonst - else { - myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; - mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; - } - } else { - // doch nich raisen, sondern nur checken, weil highestSets bereits sehr hoch !!! - if(! (4 * currentHand->getSmallBlind() > currentHand->getCurrentBeRo()->getHighestSet())) { - - // All In - if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { - - mySet += myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - - } - // sonst - else { - myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; - mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; - } - } else raise = (potential - 3 ) * currentHand->getCurrentBeRo()->getHighestSet(); - } - } - } - - if (raise > 0) { - // All In - if(currentHand->getCurrentBeRo()->getHighestSet() + raise >= myCash) { - - mySet += myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - if(mySet > currentHand->getCurrentBeRo()->getHighestSet()) currentHand->getCurrentBeRo()->setHighestSet(mySet); - - } - // sonst - else { - - myCash = myCash + mySet - currentHand->getCurrentBeRo()->getHighestSet() - raise; - mySet = currentHand->getCurrentBeRo()->getHighestSet() + raise; - currentHand->getCurrentBeRo()->setHighestSet(mySet); - myAction = PLAYER_ACTION_RAISE; - } - } - } - //CHECK und CALL - else { - // CHECK --> wenn alle Sets glieich bei BigBlind und nich zu hohem Potential - if(mySet == currentHand->getCurrentBeRo()->getHighestSet()) { - myAction = PLAYER_ACTION_CHECK; - } - // CALL --> bei normalen Potential - else { - // All In - if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { - - mySet += myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - - } - // sonst - else { - myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; - mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; - } - } - } - } -} - -void LocalPlayer::flopEngine3() -{ - - // Prozent ausrechnen - - int i, j, k ,l; - int tempBoardCardsArray[5]; - int tempMyCardsArray[7]; - int tempOpponentCardsArray[7]; - currentHand->getBoard()->getMyCards(tempBoardCardsArray); - - tempMyCardsArray[0] = myHoleCards[0]; - tempMyCardsArray[1] = myHoleCards[1]; - tempMyCardsArray[2] = tempBoardCardsArray[0]; - tempMyCardsArray[3] = tempBoardCardsArray[1]; - tempMyCardsArray[4] = tempBoardCardsArray[2]; - - tempOpponentCardsArray[2] = tempBoardCardsArray[0]; - tempOpponentCardsArray[3] = tempBoardCardsArray[1]; - tempOpponentCardsArray[4] = tempBoardCardsArray[2]; - - int tempMyCardsValue; - int tempOpponentCardsValue; - - int countAll = 0; - int countMy = 0; - - for(i=0; i<49; i++) { - if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) { - for(j=i+1; j<50; j++) { - if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) { - for(k=j+1; k<51; k++) { - if(k != myHoleCards[0] && k != myHoleCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) { - for(l=k+1; l<52; l++) { - if(l != myHoleCards[0] && l != myHoleCards[1] && l != tempBoardCardsArray[0] && l != tempBoardCardsArray[1] && l != tempBoardCardsArray[2]) { - - countAll++; - - tempOpponentCardsArray[0] = i; - tempOpponentCardsArray[1] = j; - tempOpponentCardsArray[5] = k; - tempOpponentCardsArray[6] = l; - tempMyCardsArray[5] = k; - tempMyCardsArray[6] = l; - tempMyCardsValue = CardsValue::cardsValueOld(tempMyCardsArray,0); - tempOpponentCardsValue = CardsValue::cardsValueOld(tempOpponentCardsArray,0); - - if(tempMyCardsValue>=tempOpponentCardsValue) countMy++; - - } - } - } - } - } - } - } - } - - double percent = (countMy*1.0)/(countAll*1.0); - // cout << "Prozent: " << percent << endl; - - // Bauchgefhl (zufᅵlig) - int tempRand; - Tools::GetRand((int)(percent*10.)-2, (int)(percent*10.)+2, 1, &tempRand); - - // bluff, checkbluff - int bluff; - Tools::GetRand(1, 100, 1, &bluff); - - // cout << "flop-bluff " << bluff << endl; - - // Potential - int potential = (10*(5*(int)(percent*100.)+10*tempRand*2))/700-myDude; - - int setToHighest = currentHand->getCurrentBeRo()->getHighestSet() - mySet; - - // temp fr das Vielfache des Small Blind, sodass HighestSet zu hoch ist - int tempFold; - // tempFold = (currentHand->getPlayerArray()[0]->getMyAverageSets())/(8*currentHand->getSmallBlind()); - Tools::GetRand(2, 3, 1, &tempFold); - - // FOLD --> wenn potential negativ oder HighestSet zu hoch - if(( potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 3 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 9 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 20*tempFold * currentHand->getSmallBlind() && potential<4) || (setToHighest > 40 *tempFold * currentHand->getSmallBlind() && potential<5)) && percent < 0.90 && bluff > 18) { - myAction = PLAYER_ACTION_FOLD; - } else { - // CHECK und BET --> wenn noch keiner was gesetzt hat - if(currentHand->getCurrentBeRo()->getHighestSet() == 0) { - // CHECK --> wenn Potential klein oder check-bluff sonst bet oder bet-bluff - if((potential<3 || bluff >= 80) && bluff > 15) { - // check - myAction = PLAYER_ACTION_CHECK; - } - // BET --> wenn Potential hoch - else { - if(bluff <= 5) mySet = (bluff+1) * currentHand->getSmallBlind(); - else { - if(bluff <=15 ) mySet = 4 * currentHand->getSmallBlind(); - // je höher das Potential, desto höher der Einsatz (zur Basis SmallBlind) - else mySet = (potential-1) * 2 * currentHand->getSmallBlind(); - } - - // All In - if(mySet >= myCash) { - mySet = myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - - } - // sonst - else { - myCash -= mySet; - myAction = PLAYER_ACTION_BET; - } - currentHand->getCurrentBeRo()->setHighestSet(mySet); - } - - } - // CALL und RAISE --> wenn bereits gesetzt wurde - else { - // RAISE --> wenn Potential besonders gut - if((potential >=4 && 2 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet()) || (bluff <= 5 && 4 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet())) { - - int raise = 0; - - // bluff - raise - if(bluff <=5) raise = ((bluff+1)/2) * currentHand->getCurrentBeRo()->getHighestSet(); - // Betrag, der ber dem aktuell HighestSet gesetzt werden soll - else raise = ((potential - 2 ) / 2) * currentHand->getCurrentBeRo()->getHighestSet(); - - // All In - if(currentHand->getCurrentBeRo()->getHighestSet() + raise >= myCash) { - - mySet += myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - if(mySet > currentHand->getCurrentBeRo()->getHighestSet()) currentHand->getCurrentBeRo()->setHighestSet(mySet); - - } - // sonst - else { - - myCash = myCash + mySet - currentHand->getCurrentBeRo()->getHighestSet() - raise; - mySet = currentHand->getCurrentBeRo()->getHighestSet() + raise; - currentHand->getCurrentBeRo()->setHighestSet(mySet); - myAction = PLAYER_ACTION_RAISE; - } - } - // CALL --> bei normalen Potential - else { - - // All In - if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { - - mySet += myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - - } - // sonst - else { - myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; - mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; - } - } - } - } - - -} - -void LocalPlayer::turnEngine3() -{ - - // Prozent ausrechnen - - int i, j, k; - int tempBoardCardsArray[5]; - int tempMyCardsArray[7]; - int tempOpponentCardsArray[7]; - currentHand->getBoard()->getMyCards(tempBoardCardsArray); - - tempMyCardsArray[0] = myHoleCards[0]; - tempMyCardsArray[1] = myHoleCards[1]; - tempMyCardsArray[2] = tempBoardCardsArray[0]; - tempMyCardsArray[3] = tempBoardCardsArray[1]; - tempMyCardsArray[4] = tempBoardCardsArray[2]; - tempMyCardsArray[5] = tempBoardCardsArray[3]; - - tempOpponentCardsArray[2] = tempBoardCardsArray[0]; - tempOpponentCardsArray[3] = tempBoardCardsArray[1]; - tempOpponentCardsArray[4] = tempBoardCardsArray[2]; - tempOpponentCardsArray[5] = tempBoardCardsArray[3]; - - int tempMyCardsValue; - int tempOpponentCardsValue; - - int countAll = 0; - int countMy = 0; - - for(i=0; i<49; i++) { - if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) { - for(j=i+1; j<50; j++) { - if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) { - for(k=j+1; k<51; k++) { - if(k != myHoleCards[0] && k != myHoleCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) { - - countAll++; - - tempOpponentCardsArray[0] = i; - tempOpponentCardsArray[1] = j; - tempOpponentCardsArray[6] = k; - tempMyCardsArray[6] = k; - tempMyCardsValue = CardsValue::cardsValueOld(tempMyCardsArray,0); - tempOpponentCardsValue = CardsValue::cardsValueOld(tempOpponentCardsArray,0); - - if(tempMyCardsValue>=tempOpponentCardsValue) countMy++; - } - } - } - } - } - } - - double percent = (countMy*1.0)/(countAll*1.0); - // cout << "Prozent: " << percent << endl; - - // Bauchgefhl (zufᅵlig) - int tempRand; - Tools::GetRand((int)(percent*10.)-2, (int)(percent*10.)+2, 1, &tempRand); - - // bluff, checkbluff - int bluff; - Tools::GetRand(1, 100, 1, &bluff); - - // cout << "turn-bluff " << bluff << endl; - - // Potential - int potential = (10*(5*(int)(percent*100.)+10*tempRand*2))/700-myDude; - - int setToHighest = currentHand->getCurrentBeRo()->getHighestSet() - mySet; - - // temp fr das Vielfache des Small Blind, sodass HighestSet zu hoch ist - int tempFold; - // tempFold = (currentHand->getPlayerArray()[0]->getMyAverageSets())/(7*currentHand->getSmallBlind()); - Tools::GetRand(3, 4, 1, &tempFold); - - // FOLD - // --> wenn potential negativ oder HighestSet zu hoch - if( (potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 3 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 9 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 20*tempFold * currentHand->getSmallBlind() && potential<4) || (setToHighest > 40 *tempFold * currentHand->getSmallBlind() && potential<5)) && percent < 0.90 && bluff > 15) { - myAction = PLAYER_ACTION_FOLD; - } else { - // CHECK und BET --> wenn noch keiner was gesetzt hat - if(currentHand->getCurrentBeRo()->getHighestSet() == 0) { - // CHECK --> wenn Potential klein - if((potential<2 || bluff >= 80) && bluff > 10) { - // check - myAction = PLAYER_ACTION_CHECK; - } - // BET --> wenn Potential hoch - else { - - if(bluff <= 3) mySet = bluff * 2 * currentHand->getSmallBlind(); - else { - if(bluff <=10 ) mySet = ((bluff+2)/3) * currentHand->getSmallBlind(); - // je hᅵer das Potential, desto hᅵher der Einsatz (zur Basis SmallBlind) - else mySet = (potential-1) * 3 * currentHand->getSmallBlind(); - } - - // All In - if(mySet >= myCash) { - mySet = myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - - } - // sonst - else { - myCash -= mySet; - myAction = PLAYER_ACTION_BET; - } - currentHand->getCurrentBeRo()->setHighestSet(mySet); - } - - } - // CALL und RAISE --> wenn bereits gesetzt wurde - else { - // RAISE --> wenn Potential besonders gut - if((potential >=4 && 2 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet()) || (bluff <= 4 && 3 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet())) { - - int raise = 0; - - // bluff - raise - if(bluff <= 4) raise = ((bluff+1)/2) * currentHand->getCurrentBeRo()->getHighestSet(); - // Betrag, der ber dem aktuell HighestSet gesetzt werden soll - else raise = ( potential - 3 ) * currentHand->getCurrentBeRo()->getHighestSet(); - - // All In - if(currentHand->getCurrentBeRo()->getHighestSet() + raise >= myCash) { - - mySet += myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - if(mySet > currentHand->getCurrentBeRo()->getHighestSet()) currentHand->getCurrentBeRo()->setHighestSet(mySet); - - } - // sonst - else { - - myCash = myCash + mySet - currentHand->getCurrentBeRo()->getHighestSet() - raise; - mySet = currentHand->getCurrentBeRo()->getHighestSet() + raise; - currentHand->getCurrentBeRo()->setHighestSet(mySet); - myAction = PLAYER_ACTION_RAISE; - } - } - // CALL --> bei normalen Potential - else { - // All In - if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { - - mySet += myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - - } - // sonst - else { - myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; - mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; - } - } - } - } - -} - -void LocalPlayer::riverEngine3() -{ - - // Prozent ausrechnen - - int i, j; - int tempBoardCardsArray[5]; - int tempMyCardsArray[7]; - int tempOpponentCardsArray[7]; - currentHand->getBoard()->getMyCards(tempBoardCardsArray); - - tempMyCardsArray[0] = myHoleCards[0]; - tempMyCardsArray[1] = myHoleCards[1]; - tempMyCardsArray[2] = tempBoardCardsArray[0]; - tempMyCardsArray[3] = tempBoardCardsArray[1]; - tempMyCardsArray[4] = tempBoardCardsArray[2]; - tempMyCardsArray[5] = tempBoardCardsArray[3]; - tempMyCardsArray[6] = tempBoardCardsArray[4]; - - tempOpponentCardsArray[2] = tempBoardCardsArray[0]; - tempOpponentCardsArray[3] = tempBoardCardsArray[1]; - tempOpponentCardsArray[4] = tempBoardCardsArray[2]; - tempOpponentCardsArray[5] = tempBoardCardsArray[3]; - tempOpponentCardsArray[6] = tempBoardCardsArray[4]; - - int tempMyCardsValue; - int tempOpponentCardsValue; - - int countAll = 0; - int countMy = 0; - - for(i=0; i<49; i++) { - if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) { - for(j=i+1; j<50; j++) { - if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) { - - countAll++; - - tempOpponentCardsArray[0] = i; - tempOpponentCardsArray[1] = j; - tempMyCardsValue = CardsValue::cardsValueOld(tempMyCardsArray,0); - tempOpponentCardsValue = CardsValue::cardsValueOld(tempOpponentCardsArray,0); - - if(tempMyCardsValue>=tempOpponentCardsValue) countMy++; - } - } - } - } - - double percent = (countMy*1.0)/(countAll*1.0); - // cout << "Prozent: " << percent << endl; - - // Bauchgefhl (zufᅵlig) - int tempRand; - Tools::GetRand((int)(percent*10.)-2, (int)(percent*10.)+2, 1, &tempRand); - - // bluff, checkbluff - int bluff; - Tools::GetRand(1, 100, 1, &bluff); - - // cout << "river-bluff " << bluff << endl; - - // Potential - int potential = (10*(5*(int)(percent*100.)+10*tempRand*1))/600-myDude; - - int setToHighest = currentHand->getCurrentBeRo()->getHighestSet() - mySet; - - // temp fr das Vielfache des Small Blind, sodass HighestSet zu hoch ist - int tempFold; - // tempFold = (currentHand->getPlayerArray()[0]->getMyAverageSets())/(6*currentHand->getSmallBlind()); - Tools::GetRand(4, 6, 1, &tempFold); - - // FOLD - // --> wenn potential negativ oder HighestSet zu hoch - if( (potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 3 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 9 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 20*tempFold * currentHand->getSmallBlind() && potential<4) || (setToHighest > 40 *tempFold * currentHand->getSmallBlind() && potential<5)) && percent < 0.90 && bluff > 15) { - myAction = PLAYER_ACTION_FOLD; - } else { - // CHECK und BET --> wenn noch keiner was gesetzt hat - if(currentHand->getCurrentBeRo()->getHighestSet() == 0) { - // CHECK --> wenn Potential klein - if((potential<2 || bluff >= 92) && bluff > 15) { - // check - myAction = PLAYER_ACTION_CHECK; - } - // BET --> wenn Potential hoch - else { - - if(bluff <= 5) mySet = (bluff+3) * currentHand->getSmallBlind(); - else { - if(bluff <= 15 ) mySet = ((bluff-1)/5) * 2 * currentHand->getSmallBlind(); - // je hᅵer das Potential, desto hᅵher der Einsatz (zur Basis SmallBlind) - else mySet = (potential-1) * 4 * currentHand->getSmallBlind(); - } - - // All In - if(mySet >= myCash) { - mySet = myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - - } - // sonst - else { - myCash -= mySet; - myAction = PLAYER_ACTION_BET; - } - currentHand->getCurrentBeRo()->setHighestSet(mySet); - } - - } - // CALL und RAISE --> wenn bereits gesetzt wurde - else { - // RAISE --> wenn Potential besonders gut - if((potential >=4 && 2 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet()) || (bluff <= 2 && 4 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet())) { - - int raise = 0; - - // bluff - raise - if(bluff <= 2 ) raise = bluff * currentHand->getCurrentBeRo()->getHighestSet(); - // Betrag, der ber dem aktuell HighestSet gesetzt werden soll - else raise = ( potential - 3 ) * currentHand->getCurrentBeRo()->getHighestSet(); - - // All In - if(currentHand->getCurrentBeRo()->getHighestSet() + raise >= myCash) { - - mySet += myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - if(mySet > currentHand->getCurrentBeRo()->getHighestSet()) currentHand->getCurrentBeRo()->setHighestSet(mySet); - - } - // sonst - else { - - myCash = myCash + mySet - currentHand->getCurrentBeRo()->getHighestSet() - raise; - mySet = currentHand->getCurrentBeRo()->getHighestSet() + raise; - currentHand->getCurrentBeRo()->setHighestSet(mySet); - myAction = PLAYER_ACTION_RAISE; - } - } - // CALL --> bei normalen Potential - else { - // All In - if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { - - mySet += myCash; - myCash = 0; - myAction = PLAYER_ACTION_ALLIN; - - } - // sonst - else { - myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; - mySet = currentHand->getCurrentBeRo()->getHighestSet(); - myAction = PLAYER_ACTION_CALL; - } - } - } - } - -} +//void LocalPlayer::preflopEngine3() +//{ + +// // cout << "nextID " << currentHand->getPlayerArray()[(myID+1)%5]->getMyID() << endl; + + +// // Bauchgefhl (zufᅵlig) +// int tempRand; +// Tools::GetRand(1, 10, 1, &tempRand); + +// // bluff, checkbluff +// int bluff; +// Tools::GetRand(1, 100, 1, &bluff); + +// // cout << "preflop-bluff " << bluff << endl; + +// // Potential +// int potential = 10*(4*(CardsValue::holeCardsClass(myHoleCards[0], myHoleCards[1]))+1*tempRand)/50-myDude; + +// int setToHighest = currentHand->getCurrentBeRo()->getHighestSet() - mySet; + +// // temp fr das Vielfache des Small Blind, sodass HighestSet zu hoch ist +// int tempFold; +// // tempFold = (currentHand->getPlayerArray()[0]->getMyAverageSets())/(8*currentHand->getSmallBlind()); +// Tools::GetRand(2, 3, 1, &tempFold); + +// // FOLD --> wenn Potential negativ oder HighestSet zu hoch +// if( (potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 2 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 4 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 10 * tempFold * currentHand->getSmallBlind() && potential<4)) && CardsValue::holeCardsClass(myHoleCards[0], myHoleCards[1]) < 9 && bluff > 15) { +// myAction = PLAYER_ACTION_FOLD; +// } else { +// // RAISE --> wenn hohes Potential +// if((potential >= 4 && 6 * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet()) || bluff <= 6) { +// int raise = 0; +// // extrem hohes Potential --> groᅵr Raise +// if(potential>=6 || bluff <= 2) { + +// // bluff - raise +// if(bluff <=2 && 4 * currentHand->getSmallBlind() > currentHand->getCurrentBeRo()->getHighestSet()) { +// raise = 3 * currentHand->getCurrentBeRo()->getHighestSet(); +// } else { +// // bluff - call +// if(bluff >= 98) { +// // All In +// if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { + +// mySet += myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; + +// } +// // sonst +// else { +// myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; +// mySet = currentHand->getCurrentBeRo()->getHighestSet(); +// myAction = PLAYER_ACTION_CALL; +// } +// } else { +// // doch nich raisen, sondern nur checken, weil highestSets bereits sehr hoch !!! +// if(! (4 * currentHand->getSmallBlind() > currentHand->getCurrentBeRo()->getHighestSet())) { + +// // All In +// if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { + +// mySet += myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; + +// } +// // sonst +// else { +// myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; +// mySet = currentHand->getCurrentBeRo()->getHighestSet(); +// myAction = PLAYER_ACTION_CALL; +// } + +// } else raise = (potential - 4 ) * 2 * currentHand->getCurrentBeRo()->getHighestSet(); +// } +// } +// } +// // hohes Potential --> gemäßigter Raise +// else { +// // bluff - raise +// if(bluff <= 6 && 4 * currentHand->getSmallBlind() > currentHand->getCurrentBeRo()->getHighestSet()) { +// raise = 2*currentHand->getCurrentBeRo()->getHighestSet(); +// } else { +// // bluff - call +// if(bluff >= 93) { + +// // All In +// if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { + +// mySet += myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; + +// } +// // sonst +// else { +// myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; +// mySet = currentHand->getCurrentBeRo()->getHighestSet(); +// myAction = PLAYER_ACTION_CALL; +// } +// } else { +// // doch nich raisen, sondern nur checken, weil highestSets bereits sehr hoch !!! +// if(! (4 * currentHand->getSmallBlind() > currentHand->getCurrentBeRo()->getHighestSet())) { + +// // All In +// if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { + +// mySet += myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; + +// } +// // sonst +// else { +// myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; +// mySet = currentHand->getCurrentBeRo()->getHighestSet(); +// myAction = PLAYER_ACTION_CALL; +// } +// } else raise = (potential - 3 ) * currentHand->getCurrentBeRo()->getHighestSet(); +// } +// } +// } + +// if (raise > 0) { +// // All In +// if(currentHand->getCurrentBeRo()->getHighestSet() + raise >= myCash) { + +// mySet += myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; +// if(mySet > currentHand->getCurrentBeRo()->getHighestSet()) currentHand->getCurrentBeRo()->setHighestSet(mySet); + +// } +// // sonst +// else { + +// myCash = myCash + mySet - currentHand->getCurrentBeRo()->getHighestSet() - raise; +// mySet = currentHand->getCurrentBeRo()->getHighestSet() + raise; +// currentHand->getCurrentBeRo()->setHighestSet(mySet); +// myAction = PLAYER_ACTION_RAISE; +// } +// } +// } +// //CHECK und CALL +// else { +// // CHECK --> wenn alle Sets glieich bei BigBlind und nich zu hohem Potential +// if(mySet == currentHand->getCurrentBeRo()->getHighestSet()) { +// myAction = PLAYER_ACTION_CHECK; +// } +// // CALL --> bei normalen Potential +// else { +// // All In +// if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { + +// mySet += myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; + +// } +// // sonst +// else { +// myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; +// mySet = currentHand->getCurrentBeRo()->getHighestSet(); +// myAction = PLAYER_ACTION_CALL; +// } +// } +// } +// } +//} + +//void LocalPlayer::flopEngine3() +//{ + +// // Prozent ausrechnen + +// int i, j, k ,l; +// int tempBoardCardsArray[5]; +// int tempMyCardsArray[7]; +// int tempOpponentCardsArray[7]; +// currentHand->getBoard()->getMyCards(tempBoardCardsArray); + +// tempMyCardsArray[0] = myHoleCards[0]; +// tempMyCardsArray[1] = myHoleCards[1]; +// tempMyCardsArray[2] = tempBoardCardsArray[0]; +// tempMyCardsArray[3] = tempBoardCardsArray[1]; +// tempMyCardsArray[4] = tempBoardCardsArray[2]; + +// tempOpponentCardsArray[2] = tempBoardCardsArray[0]; +// tempOpponentCardsArray[3] = tempBoardCardsArray[1]; +// tempOpponentCardsArray[4] = tempBoardCardsArray[2]; + +// int tempMyCardsValue; +// int tempOpponentCardsValue; + +// int countAll = 0; +// int countMy = 0; + +// for(i=0; i<49; i++) { +// if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) { +// for(j=i+1; j<50; j++) { +// if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) { +// for(k=j+1; k<51; k++) { +// if(k != myHoleCards[0] && k != myHoleCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) { +// for(l=k+1; l<52; l++) { +// if(l != myHoleCards[0] && l != myHoleCards[1] && l != tempBoardCardsArray[0] && l != tempBoardCardsArray[1] && l != tempBoardCardsArray[2]) { + +// countAll++; + +// tempOpponentCardsArray[0] = i; +// tempOpponentCardsArray[1] = j; +// tempOpponentCardsArray[5] = k; +// tempOpponentCardsArray[6] = l; +// tempMyCardsArray[5] = k; +// tempMyCardsArray[6] = l; +// tempMyCardsValue = CardsValue::cardsValueOld(tempMyCardsArray,0); +// tempOpponentCardsValue = CardsValue::cardsValueOld(tempOpponentCardsArray,0); + +// if(tempMyCardsValue>=tempOpponentCardsValue) countMy++; + +// } +// } +// } +// } +// } +// } +// } +// } + +// double percent = (countMy*1.0)/(countAll*1.0); +// // cout << "Prozent: " << percent << endl; + +// // Bauchgefhl (zufᅵlig) +// int tempRand; +// Tools::GetRand((int)(percent*10.)-2, (int)(percent*10.)+2, 1, &tempRand); + +// // bluff, checkbluff +// int bluff; +// Tools::GetRand(1, 100, 1, &bluff); + +// // cout << "flop-bluff " << bluff << endl; + +// // Potential +// int potential = (10*(5*(int)(percent*100.)+10*tempRand*2))/700-myDude; + +// int setToHighest = currentHand->getCurrentBeRo()->getHighestSet() - mySet; + +// // temp fr das Vielfache des Small Blind, sodass HighestSet zu hoch ist +// int tempFold; +// // tempFold = (currentHand->getPlayerArray()[0]->getMyAverageSets())/(8*currentHand->getSmallBlind()); +// Tools::GetRand(2, 3, 1, &tempFold); + +// // FOLD --> wenn potential negativ oder HighestSet zu hoch +// if(( potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 3 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 9 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 20*tempFold * currentHand->getSmallBlind() && potential<4) || (setToHighest > 40 *tempFold * currentHand->getSmallBlind() && potential<5)) && percent < 0.90 && bluff > 18) { +// myAction = PLAYER_ACTION_FOLD; +// } else { +// // CHECK und BET --> wenn noch keiner was gesetzt hat +// if(currentHand->getCurrentBeRo()->getHighestSet() == 0) { +// // CHECK --> wenn Potential klein oder check-bluff sonst bet oder bet-bluff +// if((potential<3 || bluff >= 80) && bluff > 15) { +// // check +// myAction = PLAYER_ACTION_CHECK; +// } +// // BET --> wenn Potential hoch +// else { +// if(bluff <= 5) mySet = (bluff+1) * currentHand->getSmallBlind(); +// else { +// if(bluff <=15 ) mySet = 4 * currentHand->getSmallBlind(); +// // je höher das Potential, desto höher der Einsatz (zur Basis SmallBlind) +// else mySet = (potential-1) * 2 * currentHand->getSmallBlind(); +// } + +// // All In +// if(mySet >= myCash) { +// mySet = myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; + +// } +// // sonst +// else { +// myCash -= mySet; +// myAction = PLAYER_ACTION_BET; +// } +// currentHand->getCurrentBeRo()->setHighestSet(mySet); +// } + +// } +// // CALL und RAISE --> wenn bereits gesetzt wurde +// else { +// // RAISE --> wenn Potential besonders gut +// if((potential >=4 && 2 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet()) || (bluff <= 5 && 4 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet())) { + +// int raise = 0; + +// // bluff - raise +// if(bluff <=5) raise = ((bluff+1)/2) * currentHand->getCurrentBeRo()->getHighestSet(); +// // Betrag, der ber dem aktuell HighestSet gesetzt werden soll +// else raise = ((potential - 2 ) / 2) * currentHand->getCurrentBeRo()->getHighestSet(); + +// // All In +// if(currentHand->getCurrentBeRo()->getHighestSet() + raise >= myCash) { + +// mySet += myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; +// if(mySet > currentHand->getCurrentBeRo()->getHighestSet()) currentHand->getCurrentBeRo()->setHighestSet(mySet); + +// } +// // sonst +// else { + +// myCash = myCash + mySet - currentHand->getCurrentBeRo()->getHighestSet() - raise; +// mySet = currentHand->getCurrentBeRo()->getHighestSet() + raise; +// currentHand->getCurrentBeRo()->setHighestSet(mySet); +// myAction = PLAYER_ACTION_RAISE; +// } +// } +// // CALL --> bei normalen Potential +// else { + +// // All In +// if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { + +// mySet += myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; + +// } +// // sonst +// else { +// myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; +// mySet = currentHand->getCurrentBeRo()->getHighestSet(); +// myAction = PLAYER_ACTION_CALL; +// } +// } +// } +// } + + +//} + +//void LocalPlayer::turnEngine3() +//{ + +// // Prozent ausrechnen + +// int i, j, k; +// int tempBoardCardsArray[5]; +// int tempMyCardsArray[7]; +// int tempOpponentCardsArray[7]; +// currentHand->getBoard()->getMyCards(tempBoardCardsArray); + +// tempMyCardsArray[0] = myHoleCards[0]; +// tempMyCardsArray[1] = myHoleCards[1]; +// tempMyCardsArray[2] = tempBoardCardsArray[0]; +// tempMyCardsArray[3] = tempBoardCardsArray[1]; +// tempMyCardsArray[4] = tempBoardCardsArray[2]; +// tempMyCardsArray[5] = tempBoardCardsArray[3]; + +// tempOpponentCardsArray[2] = tempBoardCardsArray[0]; +// tempOpponentCardsArray[3] = tempBoardCardsArray[1]; +// tempOpponentCardsArray[4] = tempBoardCardsArray[2]; +// tempOpponentCardsArray[5] = tempBoardCardsArray[3]; + +// int tempMyCardsValue; +// int tempOpponentCardsValue; + +// int countAll = 0; +// int countMy = 0; + +// for(i=0; i<49; i++) { +// if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) { +// for(j=i+1; j<50; j++) { +// if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) { +// for(k=j+1; k<51; k++) { +// if(k != myHoleCards[0] && k != myHoleCards[1] && k != tempBoardCardsArray[0] && k != tempBoardCardsArray[1] && k != tempBoardCardsArray[2]) { + +// countAll++; + +// tempOpponentCardsArray[0] = i; +// tempOpponentCardsArray[1] = j; +// tempOpponentCardsArray[6] = k; +// tempMyCardsArray[6] = k; +// tempMyCardsValue = CardsValue::cardsValueOld(tempMyCardsArray,0); +// tempOpponentCardsValue = CardsValue::cardsValueOld(tempOpponentCardsArray,0); + +// if(tempMyCardsValue>=tempOpponentCardsValue) countMy++; +// } +// } +// } +// } +// } +// } + +// double percent = (countMy*1.0)/(countAll*1.0); +// // cout << "Prozent: " << percent << endl; + +// // Bauchgefhl (zufᅵlig) +// int tempRand; +// Tools::GetRand((int)(percent*10.)-2, (int)(percent*10.)+2, 1, &tempRand); + +// // bluff, checkbluff +// int bluff; +// Tools::GetRand(1, 100, 1, &bluff); + +// // cout << "turn-bluff " << bluff << endl; + +// // Potential +// int potential = (10*(5*(int)(percent*100.)+10*tempRand*2))/700-myDude; + +// int setToHighest = currentHand->getCurrentBeRo()->getHighestSet() - mySet; + +// // temp fr das Vielfache des Small Blind, sodass HighestSet zu hoch ist +// int tempFold; +// // tempFold = (currentHand->getPlayerArray()[0]->getMyAverageSets())/(7*currentHand->getSmallBlind()); +// Tools::GetRand(3, 4, 1, &tempFold); + +// // FOLD +// // --> wenn potential negativ oder HighestSet zu hoch +// if( (potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 3 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 9 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 20*tempFold * currentHand->getSmallBlind() && potential<4) || (setToHighest > 40 *tempFold * currentHand->getSmallBlind() && potential<5)) && percent < 0.90 && bluff > 15) { +// myAction = PLAYER_ACTION_FOLD; +// } else { +// // CHECK und BET --> wenn noch keiner was gesetzt hat +// if(currentHand->getCurrentBeRo()->getHighestSet() == 0) { +// // CHECK --> wenn Potential klein +// if((potential<2 || bluff >= 80) && bluff > 10) { +// // check +// myAction = PLAYER_ACTION_CHECK; +// } +// // BET --> wenn Potential hoch +// else { + +// if(bluff <= 3) mySet = bluff * 2 * currentHand->getSmallBlind(); +// else { +// if(bluff <=10 ) mySet = ((bluff+2)/3) * currentHand->getSmallBlind(); +// // je hᅵer das Potential, desto hᅵher der Einsatz (zur Basis SmallBlind) +// else mySet = (potential-1) * 3 * currentHand->getSmallBlind(); +// } + +// // All In +// if(mySet >= myCash) { +// mySet = myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; + +// } +// // sonst +// else { +// myCash -= mySet; +// myAction = PLAYER_ACTION_BET; +// } +// currentHand->getCurrentBeRo()->setHighestSet(mySet); +// } + +// } +// // CALL und RAISE --> wenn bereits gesetzt wurde +// else { +// // RAISE --> wenn Potential besonders gut +// if((potential >=4 && 2 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet()) || (bluff <= 4 && 3 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet())) { + +// int raise = 0; + +// // bluff - raise +// if(bluff <= 4) raise = ((bluff+1)/2) * currentHand->getCurrentBeRo()->getHighestSet(); +// // Betrag, der ber dem aktuell HighestSet gesetzt werden soll +// else raise = ( potential - 3 ) * currentHand->getCurrentBeRo()->getHighestSet(); + +// // All In +// if(currentHand->getCurrentBeRo()->getHighestSet() + raise >= myCash) { + +// mySet += myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; +// if(mySet > currentHand->getCurrentBeRo()->getHighestSet()) currentHand->getCurrentBeRo()->setHighestSet(mySet); + +// } +// // sonst +// else { + +// myCash = myCash + mySet - currentHand->getCurrentBeRo()->getHighestSet() - raise; +// mySet = currentHand->getCurrentBeRo()->getHighestSet() + raise; +// currentHand->getCurrentBeRo()->setHighestSet(mySet); +// myAction = PLAYER_ACTION_RAISE; +// } +// } +// // CALL --> bei normalen Potential +// else { +// // All In +// if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { + +// mySet += myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; + +// } +// // sonst +// else { +// myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; +// mySet = currentHand->getCurrentBeRo()->getHighestSet(); +// myAction = PLAYER_ACTION_CALL; +// } +// } +// } +// } + +//} + +//void LocalPlayer::riverEngine3() +//{ + +// // Prozent ausrechnen + +// int i, j; +// int tempBoardCardsArray[5]; +// int tempMyCardsArray[7]; +// int tempOpponentCardsArray[7]; +// currentHand->getBoard()->getMyCards(tempBoardCardsArray); + +// tempMyCardsArray[0] = myHoleCards[0]; +// tempMyCardsArray[1] = myHoleCards[1]; +// tempMyCardsArray[2] = tempBoardCardsArray[0]; +// tempMyCardsArray[3] = tempBoardCardsArray[1]; +// tempMyCardsArray[4] = tempBoardCardsArray[2]; +// tempMyCardsArray[5] = tempBoardCardsArray[3]; +// tempMyCardsArray[6] = tempBoardCardsArray[4]; + +// tempOpponentCardsArray[2] = tempBoardCardsArray[0]; +// tempOpponentCardsArray[3] = tempBoardCardsArray[1]; +// tempOpponentCardsArray[4] = tempBoardCardsArray[2]; +// tempOpponentCardsArray[5] = tempBoardCardsArray[3]; +// tempOpponentCardsArray[6] = tempBoardCardsArray[4]; + +// int tempMyCardsValue; +// int tempOpponentCardsValue; + +// int countAll = 0; +// int countMy = 0; + +// for(i=0; i<49; i++) { +// if(i != myHoleCards[0] && i != myHoleCards[1] && i != tempBoardCardsArray[0] && i != tempBoardCardsArray[1] && i != tempBoardCardsArray[2]) { +// for(j=i+1; j<50; j++) { +// if(j != myHoleCards[0] && j != myHoleCards[1] && j != tempBoardCardsArray[0] && j != tempBoardCardsArray[1] && j != tempBoardCardsArray[2]) { + +// countAll++; + +// tempOpponentCardsArray[0] = i; +// tempOpponentCardsArray[1] = j; +// tempMyCardsValue = CardsValue::cardsValueOld(tempMyCardsArray,0); +// tempOpponentCardsValue = CardsValue::cardsValueOld(tempOpponentCardsArray,0); + +// if(tempMyCardsValue>=tempOpponentCardsValue) countMy++; +// } +// } +// } +// } + +// double percent = (countMy*1.0)/(countAll*1.0); +// // cout << "Prozent: " << percent << endl; + +// // Bauchgefhl (zufᅵlig) +// int tempRand; +// Tools::GetRand((int)(percent*10.)-2, (int)(percent*10.)+2, 1, &tempRand); + +// // bluff, checkbluff +// int bluff; +// Tools::GetRand(1, 100, 1, &bluff); + +// // cout << "river-bluff " << bluff << endl; + +// // Potential +// int potential = (10*(5*(int)(percent*100.)+10*tempRand*1))/600-myDude; + +// int setToHighest = currentHand->getCurrentBeRo()->getHighestSet() - mySet; + +// // temp fr das Vielfache des Small Blind, sodass HighestSet zu hoch ist +// int tempFold; +// // tempFold = (currentHand->getPlayerArray()[0]->getMyAverageSets())/(6*currentHand->getSmallBlind()); +// Tools::GetRand(4, 6, 1, &tempFold); + +// // FOLD +// // --> wenn potential negativ oder HighestSet zu hoch +// if( (potential*setToHighest<0 || (setToHighest > tempFold * currentHand->getSmallBlind() && potential<1) || (setToHighest > 3 * tempFold * currentHand->getSmallBlind() && potential<2) || (setToHighest > 9 * tempFold * currentHand->getSmallBlind() && potential<3) || (setToHighest > 20*tempFold * currentHand->getSmallBlind() && potential<4) || (setToHighest > 40 *tempFold * currentHand->getSmallBlind() && potential<5)) && percent < 0.90 && bluff > 15) { +// myAction = PLAYER_ACTION_FOLD; +// } else { +// // CHECK und BET --> wenn noch keiner was gesetzt hat +// if(currentHand->getCurrentBeRo()->getHighestSet() == 0) { +// // CHECK --> wenn Potential klein +// if((potential<2 || bluff >= 92) && bluff > 15) { +// // check +// myAction = PLAYER_ACTION_CHECK; +// } +// // BET --> wenn Potential hoch +// else { + +// if(bluff <= 5) mySet = (bluff+3) * currentHand->getSmallBlind(); +// else { +// if(bluff <= 15 ) mySet = ((bluff-1)/5) * 2 * currentHand->getSmallBlind(); +// // je hᅵer das Potential, desto hᅵher der Einsatz (zur Basis SmallBlind) +// else mySet = (potential-1) * 4 * currentHand->getSmallBlind(); +// } + +// // All In +// if(mySet >= myCash) { +// mySet = myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; + +// } +// // sonst +// else { +// myCash -= mySet; +// myAction = PLAYER_ACTION_BET; +// } +// currentHand->getCurrentBeRo()->setHighestSet(mySet); +// } + +// } +// // CALL und RAISE --> wenn bereits gesetzt wurde +// else { +// // RAISE --> wenn Potential besonders gut +// if((potential >=4 && 2 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet()) || (bluff <= 2 && 4 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet())) { + +// int raise = 0; + +// // bluff - raise +// if(bluff <= 2 ) raise = bluff * currentHand->getCurrentBeRo()->getHighestSet(); +// // Betrag, der ber dem aktuell HighestSet gesetzt werden soll +// else raise = ( potential - 3 ) * currentHand->getCurrentBeRo()->getHighestSet(); + +// // All In +// if(currentHand->getCurrentBeRo()->getHighestSet() + raise >= myCash) { + +// mySet += myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; +// if(mySet > currentHand->getCurrentBeRo()->getHighestSet()) currentHand->getCurrentBeRo()->setHighestSet(mySet); + +// } +// // sonst +// else { + +// myCash = myCash + mySet - currentHand->getCurrentBeRo()->getHighestSet() - raise; +// mySet = currentHand->getCurrentBeRo()->getHighestSet() + raise; +// currentHand->getCurrentBeRo()->setHighestSet(mySet); +// myAction = PLAYER_ACTION_RAISE; +// } +// } +// // CALL --> bei normalen Potential +// else { +// // All In +// if(currentHand->getCurrentBeRo()->getHighestSet() >= myCash) { + +// mySet += myCash; +// myCash = 0; +// myAction = PLAYER_ACTION_ALLIN; + +// } +// // sonst +// else { +// myCash = myCash - currentHand->getCurrentBeRo()->getHighestSet() + mySet; +// mySet = currentHand->getCurrentBeRo()->getHighestSet(); +// myAction = PLAYER_ACTION_CALL; +// } +// } +// } +// } + +//} void LocalPlayer::setIsSessionActive(bool active) { diff --git a/src/engine/local_engine/localplayer.h b/src/engine/local_engine/localplayer.h index eac742e7..580235f0 100755 --- a/src/engine/local_engine/localplayer.h +++ b/src/engine/local_engine/localplayer.h @@ -282,10 +282,10 @@ public: void turnEngine(); void riverEngine(); - void preflopEngine3(); - void flopEngine3(); - void turnEngine3(); - void riverEngine3(); +// void preflopEngine3(); +// void flopEngine3(); +// void turnEngine3(); +// void riverEngine3(); int flopCardsValue(int*); int turnCardsValue(int*); diff --git a/src/engine/log.cpp b/src/engine/log.cpp index b13fd6d2..8ceb9ca9 100644 --- a/src/engine/log.cpp +++ b/src/engine/log.cpp @@ -755,22 +755,22 @@ Log::debugMode_getStartDealerPosition(unsigned* dealerPosition) } void -Log::debugMode_getBoardCards(int *tempBoardArray, int handID) +Log::debugMode_getBoardCards(int *boardCards, int handID) { if(debug_mode) { if((unsigned)handID <= sizeof(debug_mode_boardCards)/sizeof(unsigned)/5) { - for(int i=0; i<5; i++) tempBoardArray[i] = debug_mode_boardCards[handID-1][i]; + for(int i=0; i<5; i++) boardCards[i] = debug_mode_boardCards[handID-1][i]; } } } void -Log::debugMode_getPlayerCards(int *tempPlayerArray, int handID, int seatID) +Log::debugMode_getPlayerCards(int *playerCards, int handID, int seatID) { if(debug_mode) { if((unsigned)handID <= sizeof(debug_mode_playerCards)/sizeof(int)/MAX_NUMBER_OF_PLAYERS/2) { for(int i=0; i<2; i++) { - if(debug_mode_playerCards[handID-1][seatID][i]>=0) tempPlayerArray[i] = debug_mode_playerCards[handID-1][seatID][i]; + if(debug_mode_playerCards[handID-1][seatID][i]>=0) playerCards[i] = debug_mode_playerCards[handID-1][seatID][i]; } } } diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index bff6afbc..2d9f9d4c 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -792,20 +792,20 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) //refresh board cards if game is running if(myStartWindow->getSession()->getCurrentGame()) { - int tempBoardCardsArray[5]; - myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray); + int boardCards[5]; + myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards); GameState currentState = myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->getMyBeRoID(); if(currentState >= GAME_STATE_FLOP && currentState <= GAME_STATE_POST_RIVER) for(int i=0; i<3; i++) { - QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[i], 10)+".png")); + QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[i], 10)+".png")); boardCardsArray[i]->setPixmap(card, false); } if(currentState >= GAME_STATE_TURN && currentState <= GAME_STATE_POST_RIVER) { - QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[3], 10)+".png")); + QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[3], 10)+".png")); boardCardsArray[3]->setPixmap(card, false); } if(currentState == GAME_STATE_RIVER || currentState == GAME_STATE_POST_RIVER) { - QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[4], 10)+".png")); + QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[4], 10)+".png")); boardCardsArray[4]->setPixmap(card, false); } } @@ -1532,10 +1532,10 @@ void gameTableImpl::dealFlopCards3() void gameTableImpl::dealFlopCards4() { - int tempBoardCardsArray[5]; + int boardCards[5]; - myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray); - QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[0], 10)+".png")); + myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards); + QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[0], 10)+".png")); //Config? mit oder ohne Eye-Candy? if(myConfig->readConfigInt("ShowFlipCardsAnimation")) { @@ -1552,9 +1552,9 @@ void gameTableImpl::dealFlopCards4() void gameTableImpl::dealFlopCards5() { - int tempBoardCardsArray[5]; - myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray); - QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[1], 10)+".png")); + int boardCards[5]; + myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards); + QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[1], 10)+".png")); //Config? mit oder ohne Eye-Candy? if(myConfig->readConfigInt("ShowFlipCardsAnimation")) { @@ -1571,9 +1571,9 @@ void gameTableImpl::dealFlopCards5() void gameTableImpl::dealFlopCards6() { - int tempBoardCardsArray[5]; - myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray); - QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[2], 10)+".png")); + int boardCards[5]; + myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards); + QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[2], 10)+".png")); //Config? mit oder ohne Eye-Candy? if(myConfig->readConfigInt("ShowFlipCardsAnimation")) { @@ -1615,9 +1615,9 @@ void gameTableImpl::dealTurnCards1() void gameTableImpl::dealTurnCards2() { - int tempBoardCardsArray[5]; - myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray); - QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[3], 10)+".png")); + int boardCards[5]; + myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards); + QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[3], 10)+".png")); //Config? mit oder ohne Eye-Candy? if(myConfig->readConfigInt("ShowFlipCardsAnimation")) { @@ -1660,9 +1660,9 @@ void gameTableImpl::dealRiverCards1() void gameTableImpl::dealRiverCards2() { - int tempBoardCardsArray[5]; - myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray); - QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[4], 10)+".png")); + int boardCards[5]; + myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards); + QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[4], 10)+".png")); //Config? mit oder ohne Eye-Candy? if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {