diff --git a/src/engine/local_engine/cardsvalue.cpp b/src/engine/local_engine/cardsvalue.cpp index bd921170..0a495cfa 100755 --- a/src/engine/local_engine/cardsvalue.cpp +++ b/src/engine/local_engine/cardsvalue.cpp @@ -255,7 +255,7 @@ int CardsValue::cardsValueShort(int cards[4]) // Royal Flush, Straight Flush, Flush for(color_idx=0; color_idx<4; color_idx++) { // check all colors - if(Tools::bitcount(cards[color_idx])>=5) { // check if at least 5 cards of one color + if(bitcount(cards[color_idx])>=5) { // check if at least 5 cards of one color if((cards[color_idx] & straight[0]) == straight[0]) // check for Royal Flush return 9; else { // check for Straight Flush @@ -293,7 +293,7 @@ int CardsValue::cardsValueShort(int cards[4]) for(color_2_idx=color_1_idx+1; color_2_idx<3; color_2_idx++) { for(color_3_idx=color_2_idx+1; color_3_idx<4; color_3_idx++) { temp = cards[color_1_idx] & cards[color_2_idx] & cards[color_3_idx]; - if(Tools::bitcount(temp) == 2) { // two times Three of a Kind + if(bitcount(temp) == 2) { // two times Three of a Kind return 6; // Full House } else { if(temp) { @@ -315,7 +315,7 @@ int CardsValue::cardsValueShort(int cards[4]) for(color_1_idx=0; color_1_idx<3; color_1_idx++) { for(color_2_idx=color_1_idx+1; color_2_idx<4; color_2_idx++) { temp = cards[color_1_idx] & cards[color_2_idx]; - if(Tools::bitcount(temp) >= 2) { // at least two times Two of a Kind + if(bitcount(temp) >= 2) { // at least two times Two of a Kind return 2; // Two Pairs } else { if(temp) { // search for second pair @@ -343,7 +343,7 @@ int CardsValue::cardsValue(int cards[4], int bestHand[4]) // Royal Flush, Straight Flush, Flush for(color_1_idx=0; color_1_idx<4; color_1_idx++) { // check all colors - if(Tools::bitcount(cards[color_1_idx])>=5) { // check if at least 5 cards of one color + if(bitcount(cards[color_1_idx])>=5) { // check if at least 5 cards of one color if((cards[color_1_idx] & straight[0]) == straight[0]) { // check for Royal Flush if(bestHand) bestHand[color_1_idx] = straight[0]; return 900000000; // Royal Flush @@ -396,7 +396,6 @@ int CardsValue::cardsValue(int cards[4], int bestHand[4]) } int color_2_idx, color_3_idx; - int temp2; // Full House, Three of a Kind temp1 = 0; @@ -408,12 +407,12 @@ int CardsValue::cardsValue(int cards[4], int bestHand[4]) } } if(temp1) { - if(Tools::bitcount(temp1) == 2) { + if(bitcount(temp1) == 2) { // two times Three of a Kind if(bestHand) { kickerValue1 = determineKickerValue(temp1,0,0); kickerValue2 = determineKickerValue(kickerValue1.remain,1,1); - temp2 = 0; + int temp2 = 0; for(color_1_idx=3; color_1_idx>=0; color_1_idx--) { if(temp2<2) bestHand[color_1_idx] += (cards[color_1_idx] & (kickerValue1.select | kickerValue2.select)); else bestHand[color_1_idx] += (cards[color_1_idx] & kickerValue1.select); @@ -423,7 +422,7 @@ int CardsValue::cardsValue(int cards[4], int bestHand[4]) return 600000000 + determineKickerValue(temp1,0,1).factorValue; } else { // one times Three of a Kind - temp2 = temp1; + int temp2 = temp1; temp1 = 0; // check for additional pair for(color_1_idx=0; color_1_idx<3; color_1_idx++) { @@ -460,7 +459,7 @@ int CardsValue::cardsValue(int cards[4], int bestHand[4]) } } if(temp1) { - if(Tools::bitcount(temp1) >= 2) { // at least two times Two of a Kind + if(bitcount(temp1) >= 2) { // at least two times Two of a Kind kickerValue1 = determineKickerValue(temp1,0,1); kickerValue2 = determineKickerValue(OR & ~kickerValue1.select,2,2); if(bestHand) { @@ -518,389 +517,8 @@ KickerValue CardsValue::determineKickerValue(int testValue, int factorPointerSta return kickerValue; } -int CardsValue::cardsValueOld(int cards[7], int position[5]) -{ - - int array[7][3]; - int j1, j2, j3, j4, j5, k1, k2, ktemp[3]; - - // Kartenwerte umwandeln (z.B. [ 11 (Karo K�ig) -> 0 11 ] oder [ 31 (Pik 7) -> 2 5 ] ) - for(j1=0; j1<7; j1++) { - array[j1][0] = cards[j1]/13; - array[j1][1] = cards[j1]%13; - array[j1][2] = j1; - } - - // Karten nach Farben sortieren: Kreuz - Pik - Herz - Karo - for(k1=0; k1<7; k1++) { - for(k2=k1+1; k2<7; k2++) { - if(array[k1][0] 8*100000000+3*1000000 - if(position) { - // Position-Array fuellen - position[0] = array[j1][2]; - for(j3=0; j3<4; j3++) { - position[j3+1] = array[j2+j3][2]; - } - } - return 800000000+3*1000000; - } - } - } - } - - // auf Flush (Klasse 5) testen - for(j1=0; j1<3; j1++) { - if(array[j1][0] == array[j1+1][0] && array[j1][0] == array[j1+2][0] && array[j1][0] == array[j1+3][0] && array[j1][0] == array[j1+4][0]) { - // Flush -> 5*10000000 + h�ste Flush Karten mit absteigender Wertung - if(position) { - // Position-Array fuellen - for(j2=0; j2<5; j2++) { - position[j2] = array[j1+j2][2]; - } - } - return 500000000+array[j1][1]*1000000+array[j1+1][1]*10000+array[j1+2][1]*100+array[j1+3][1]*10+array[j1+4][1]; - } - } - - - - // 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] > CardsValue::calcCardsChance(GameState beRoID, int playerCards[2], int boardCards[5]) { - int card_idx_1, card_idx_2; - std::vector< std::vector > chance(2); chance[0].assign(10,0); chance[1].assign(10,0); @@ -908,6 +526,7 @@ std::vector< std::vector > CardsValue::calcCardsChance(GameState beRoID, in int cards[4] = { 0,0,0,0 }; int sum = 0; + int card_idx_1; for(card_idx_1=0; card_idx_1<2; card_idx_1++) cards[playerCards[card_idx_1]/13] |= (1 << (playerCards[card_idx_1]%13)); switch(beRoID) { @@ -924,7 +543,7 @@ std::vector< std::vector > CardsValue::calcCardsChance(GameState beRoID, in for(card_idx_1=0; card_idx_1<51; card_idx_1++) { if((cards[card_idx_1/13] & (1 << (card_idx_1%13))) == 0) { cards[card_idx_1/13] |= (1 << (card_idx_1%13)); - for(card_idx_2=card_idx_1+1; card_idx_2<52; card_idx_2++) { + for(int card_idx_2=card_idx_1+1; card_idx_2<52; card_idx_2++) { if((cards[card_idx_2/13] & (1 << (card_idx_2%13))) == 0) { cards[card_idx_2/13] |= (1 << (card_idx_2%13)); (chance[0][cardsValueShort(cards)])++; @@ -2574,6 +2193,44 @@ std::list CardsValue::translateCardsValueCode(int cardsValueCode) } +int CardsValue::bitcount(int in) +{ + int count=0 ; + while (in) { + count++ ; + in &= (in - 1) ; + + } + return count ; +} + +int +CardsValue::bestHandToPosition(int bestHand[4], int cardArray[7], int position[5]) +{ + + for(int card_idx=0; card_idx<5; card_idx++) position[card_idx] = -1; + + int position_ctr = 0; + for(int color_idx=0; color_idx<4; color_idx++) { + for(int card_idx_1=0; card_idx_1<13; card_idx_1++) { + if(bestHand[color_idx] & (1< translateCardsValueCode(int cardsValueCode); static int holeCardsToIntCode(int[2]); static std::vector< std::vector > 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 067597ff..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); @@ -158,20 +159,19 @@ void LocalHand::start() void LocalHand::assignButtons() { - size_t i; - PlayerListIterator it; + PlayerListIterator seatIt; // delete all buttons - for (it=seatsList->begin(); it!=seatsList->end(); ++it) { - (*it)->setMyButton(BUTTON_NONE); + for (seatIt=seatsList->begin(); seatIt!=seatsList->end(); ++seatIt) { + (*seatIt)->setMyButton(BUTTON_NONE); } // assign dealer button - it = getSeatIt(dealerPosition); - if(it == seatsList->end()) { + seatIt = getSeatIt(dealerPosition); + if(seatIt == seatsList->end()) { throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND); } - (*it)->setMyButton(BUTTON_DEALER); + (*seatIt)->setMyButton(BUTTON_DEALER); // assign Small Blind next to dealer. ATTENTION: in heads up it is big blind @@ -182,40 +182,40 @@ void LocalHand::assignButtons() throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND); } - for(i=0; isize(); i++) { + for(size_t i=0; isize(); i++) { ++dealerPositionIt; if(dealerPositionIt == seatsList->end()) dealerPositionIt = seatsList->begin(); - it = getActivePlayerIt( (*dealerPositionIt)->getMyUniqueID() ); - if(it != activePlayerList->end() ) { + PlayerListIterator activePlayerIt = getActivePlayerIt( (*dealerPositionIt)->getMyUniqueID() ); + if(activePlayerIt != activePlayerList->end() ) { nextActivePlayerFound = true; if(activePlayerList->size() > 2) { //small blind normal - (*it)->setMyButton(2); - smallBlindPosition = (*it)->getMyUniqueID(); + (*activePlayerIt)->setMyButton(2); + smallBlindPosition = (*activePlayerIt)->getMyUniqueID(); } else { //big blind in heads up - (*it)->setMyButton(3); - bigBlindPosition = (*it)->getMyUniqueID(); + (*activePlayerIt)->setMyButton(3); + bigBlindPosition = (*activePlayerIt)->getMyUniqueID(); // lastPlayerAction for showing cards } // first player after dealer have to show his cards first (in showdown) - lastActionPlayerID = (*it)->getMyUniqueID(); + lastActionPlayerID = (*activePlayerIt)->getMyUniqueID(); myBoard->setLastActionPlayerID(lastActionPlayerID); - ++it; - if(it == activePlayerList->end()) it = activePlayerList->begin(); + ++activePlayerIt; + if(activePlayerIt == activePlayerList->end()) activePlayerIt = activePlayerList->begin(); if(activePlayerList->size() > 2) { //big blind normal - (*it)->setMyButton(3); - bigBlindPosition = (*it)->getMyUniqueID(); + (*activePlayerIt)->setMyButton(3); + bigBlindPosition = (*activePlayerIt)->getMyUniqueID(); } else { //small blind in heads up - (*it)->setMyButton(2); - smallBlindPosition = (*it)->getMyUniqueID(); + (*activePlayerIt)->setMyButton(2); + smallBlindPosition = (*activePlayerIt)->getMyUniqueID(); } break; @@ -395,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 8c6d4b31..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); - - 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 boardCards[5]; + currentHand->getBoard()->getMyCards(boardCards); + int card_idx_1; int myCards[4] = { 0,0,0,0 }; int opponentCards[4] = { 0,0,0,0 }; - - - int tempMyCardsValue; - int tempOpponentCardsValue; + 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/local_engine/tools.cpp b/src/engine/local_engine/tools.cpp index 974b0956..83d7ef24 100755 --- a/src/engine/local_engine/tools.cpp +++ b/src/engine/local_engine/tools.cpp @@ -82,14 +82,3 @@ void Tools::GetRand(int minValue, int maxValue, unsigned count, int *out) *startPtr++ = gen(); } } - -int Tools::bitcount(int in) -{ - int count=0 ; - while (in) { - count++ ; - in &= (in - 1) ; - } - return count ; -} - diff --git a/src/engine/local_engine/tools.h b/src/engine/local_engine/tools.h index 36fdbdae..7cd599a4 100755 --- a/src/engine/local_engine/tools.h +++ b/src/engine/local_engine/tools.h @@ -38,7 +38,6 @@ public: static void ShuffleArrayNonDeterministic(int *inout, unsigned count); static void GetRand(int minValue, int maxValue, unsigned count, int *out); - static int bitcount(int in); }; 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 1d543fe4..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")) { @@ -4310,8 +4310,7 @@ void gameTableImpl::restoreGameTableGeometry() int availableHeight = dw.screenGeometry().height(); this->showNormal(); this->setGeometry(0,0,availableWidth, availableHeight); - } - else { + } else { this->showFullScreen(); } #endif diff --git a/src/gui/qt/gametable/log/guilog.cpp b/src/gui/qt/gametable/log/guilog.cpp index a866bef8..e55b56ad 100644 --- a/src/gui/qt/gametable/log/guilog.cpp +++ b/src/gui/qt/gametable/log/guilog.cpp @@ -42,6 +42,7 @@ using namespace std; guiLog::guiLog(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), myHtmlLogFile(0), myHtmlLogFile_old(0), myTxtLogFile(0), tb(0) { + newVersion = true; myW->setGuiLog(this); myStyle = myW->getMyGameTableStyle(); @@ -470,8 +471,6 @@ void guiLog::showLog(QString fileStringPdb, QTextBrowser *tb_tmp, int uniqueGame int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) { - bool neu = true; - result_struct results; results.result_Session = 0; results.result_Game = 0; @@ -567,7 +566,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) switch(modus) { case 1: log_string = "

" + log_string + "

\n"; - // if(!neu) log_string = "\n" + log_string; + // if(!newVersion) log_string = "\n" + log_string; break; case 2: log_string += ""; @@ -658,7 +657,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) switch(modus) { case 1: log_string = "

" + log_string; - if(!neu) log_string += "
"; + if(!newVersion) log_string += ""; else log_string += ""; break; case 2: @@ -720,7 +719,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) switch(modus) { case 1: - if(!neu) log_string += "
"; + if(!newVersion) log_string += "
"; else log_string += "
"; break; case 2: @@ -758,7 +757,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) log_string += ")"; switch(modus) { case 1: - if(!neu) log_string += "
"; + if(!newVersion) log_string += "
"; else log_string += "
"; break; case 2: @@ -781,7 +780,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) } } - if(neu) { + if(newVersion) { if(modus == 1) log_string += "
"; @@ -903,7 +902,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) if(nRow_Action == 1) { switch(modus) { case 1: - if(!neu) log_string += "
"; + if(!newVersion) log_string += "
"; else log_string += "
"; break; case 2: @@ -921,7 +920,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) } - if(!neu && modus==1) log_string += "
"; + if(!newVersion && modus==1) log_string += "
"; writeLog(log_string,modus); log_string = ""; @@ -949,10 +948,10 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) } switch(modus) { case 1: - if(!neu) round_string = "
" + round_string + ""; + if(!newVersion) round_string = "
" + round_string + ""; else round_string = "
" + round_string + ""; if(round_ctr >= GAME_STATE_FLOP) { - if(!neu) round_string = "
\n" + round_string; + if(!newVersion) round_string = "
\n" + round_string; else round_string = "
\n" + round_string; } break; @@ -1019,7 +1018,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) for(action_ctr=1; action_ctr<=nRow_Action; action_ctr++) { switch(modus) { case 1: - if(!neu) { + if(!newVersion) { if(action_ctr>1 && (boost::lexical_cast(results.result_Action[3*(action_ctr-1)+1]) == "wins" || boost::lexical_cast(results.result_Action[3*(action_ctr-1)+1]) == "sits out" || boost::lexical_cast(results.result_Action[3*(action_ctr-1)+1]) == "wins (side pot)")) log_string += "\n"; else @@ -1037,7 +1036,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) default: ; } - if(!neu && boost::lexical_cast(results.result_Action[3*action_ctr+1]) == "wins (side pot)") { + if(!newVersion && boost::lexical_cast(results.result_Action[3*action_ctr+1]) == "wins (side pot)") { action_string += player[boost::lexical_cast(results.result_Action[3*action_ctr])-1]; action_string += " wins $"; action_string += boost::lexical_cast(results.result_Action[3*action_ctr+2]); @@ -1057,7 +1056,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) if(boost::lexical_cast(results.result_Action[3*action_ctr+1]) == "wins game") { switch(modus) { case 1: - if(!neu) action_string = "

" + action_string + " " + boost::lexical_cast(gameID) + "!
"; + if(!newVersion) action_string = "

" + action_string + " " + boost::lexical_cast(gameID) + "!
"; else action_string = "
" + action_string + " " + boost::lexical_cast(gameID) + "!"; break; case 2: @@ -1075,7 +1074,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) if(boost::lexical_cast(results.result_Action[3*action_ctr+1]) == "wins" || boost::lexical_cast(results.result_Action[3*action_ctr+1]) == "wins (side pot)") { switch(modus) { case 1: - if(!neu) action_string = "
" + action_string + ""; + if(!newVersion) action_string = "
" + action_string + ""; else action_string = "" + action_string + ""; break; case 3: @@ -1090,7 +1089,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) if(boost::lexical_cast(results.result_Action[3*action_ctr+1]) == "has left the game" || boost::lexical_cast(results.result_Action[3*action_ctr+1]) == "was kicked from the game" || boost::lexical_cast(results.result_Action[3*action_ctr+1]) == "is game admin now" || boost::lexical_cast(results.result_Action[3*action_ctr+1]) == "has joined the game") { switch(modus) { case 1: - if(!neu) action_string = "" + action_string + "!"; + if(!newVersion) action_string = "" + action_string + "!"; else action_string = "" + action_string + ""; break; case 3: @@ -1105,7 +1104,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) if(boost::lexical_cast(results.result_Action[3*action_ctr+1]) == "sits out") { switch(modus) { case 1: - if(!neu) action_string = "
" + action_string + ""; + if(!newVersion) action_string = "
" + action_string + ""; else action_string = "" + action_string + ""; break; case 3: @@ -1122,7 +1121,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) // show cards if(boost::lexical_cast(results.result_Action[3*action_ctr+1]) == "shows" || boost::lexical_cast(results.result_Action[3*action_ctr+1]) == "has") { // log cards - if(!neu && round_ctr == GAME_STATE_POST_RIVER) log_string += " [ "; + if(!newVersion && round_ctr == GAME_STATE_POST_RIVER) log_string += " [ "; else log_string += " ["; if(modus == 1 || modus == 3) log_string += ""; @@ -1193,10 +1192,10 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req) } - if(!neu && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "wins" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "shows" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "has" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "sits out" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "wins (side pot)" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "has joined the game") { + if(!newVersion && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "wins" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "shows" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "has" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "sits out" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "wins (side pot)" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "has joined the game") { log_string += "."; } - if(neu && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "has joined the game") + if(newVersion && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast(results.result_Action[3*action_ctr+1]) != "has joined the game") log_string += "."; } diff --git a/src/gui/qt/gametable/log/guilog.h b/src/gui/qt/gametable/log/guilog.h index 1fa2ea9f..0bf6f79f 100644 --- a/src/gui/qt/gametable/log/guilog.h +++ b/src/gui/qt/gametable/log/guilog.h @@ -137,6 +137,7 @@ private: QTextBrowser* tb; GameTableStyleReader *myStyle; std::string mySqliteLogFileName; + bool newVersion; friend class GuiWrapper; diff --git a/src/gui/qt/logfiledialog/logfiledialog.cpp b/src/gui/qt/logfiledialog/logfiledialog.cpp index e6380be7..f83be4d5 100644 --- a/src/gui/qt/logfiledialog/logfiledialog.cpp +++ b/src/gui/qt/logfiledialog/logfiledialog.cpp @@ -180,8 +180,8 @@ void LogFileDialog::exportLogToTxt() if(selectedItem) { QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString()); QFileDialog dlg(this, tr("Export PokerTH log file to plain text"), - QDir::homePath()+"/"+fi.baseName()+".txt", - tr("PokerTH plain text log (*.txt)")); + QDir::homePath()+"/"+fi.baseName()+".txt", + tr("PokerTH plain text log (*.txt)")); dlg.setFileMode(QFileDialog::AnyFile); dlg.setAcceptMode(QFileDialog::AcceptSave); #ifdef ANDROID @@ -251,8 +251,7 @@ void LogFileDialog::keyPressEvent ( QKeyEvent * event ) if(ui->treeWidget_logFiles->hasFocus()) { ui->pushButton_deleteLog->click(); } - } - else { + } else { QDialog::keyPressEvent(event); } }