From eec7e6c097aaa6a8c59cdf0c261c6e37019639f1 Mon Sep 17 00:00:00 2001 From: doitux Date: Fri, 28 Sep 2007 15:04:52 +0000 Subject: [PATCH] adds activePlayerList and runningPlayerList (XXI) - bugfixes --- src/engine/local_engine/localhand.cpp | 134 ++++++++++++++---------- src/engine/local_engine/localplayer.cpp | 31 +++--- src/game.cpp | 5 + 3 files changed, 98 insertions(+), 72 deletions(-) diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index 255a3aa3..8e46d835 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -112,11 +112,11 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI case 1: { - tempBoardArray[0] = 40; - tempBoardArray[1] = 21; + tempBoardArray[0] = 27; + tempBoardArray[1] = 37; tempBoardArray[2] = 45; - tempBoardArray[3] = 43; - tempBoardArray[4] = 50; + tempBoardArray[3] = 51; + tempBoardArray[4] = 23; myBoard->setMyCards(tempBoardArray); @@ -129,21 +129,8 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI // player0 it = seatsList->begin(); - tempPlayerArray[0] = 51; - tempPlayerArray[1] = 20; - tempPlayerAndBoardArray[0] = tempPlayerArray[0]; - tempPlayerAndBoardArray[1] = tempPlayerArray[1]; - - (*it)->setMyCards(tempPlayerArray); - (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); - - (*it)->setMyBestHandPosition(temp5Array); - - // player1 - it++; - -// tempPlayerArray[0] = 24; -// tempPlayerArray[1] = 19; +// tempPlayerArray[0] = 51; +// tempPlayerArray[1] = 20; // tempPlayerAndBoardArray[0] = tempPlayerArray[0]; // tempPlayerAndBoardArray[1] = tempPlayerArray[1]; // @@ -151,6 +138,19 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI // (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); // // (*it)->setMyBestHandPosition(temp5Array); + + // player1 + it++; + + tempPlayerArray[0] = 12; + tempPlayerArray[1] = 48; + tempPlayerAndBoardArray[0] = tempPlayerArray[0]; + tempPlayerAndBoardArray[1] = tempPlayerArray[1]; + + (*it)->setMyCards(tempPlayerArray); + (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); + + (*it)->setMyBestHandPosition(temp5Array); // player2 it++; @@ -168,21 +168,8 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI // player3 it++; - tempPlayerArray[0] = 12; - tempPlayerArray[1] = 46; - tempPlayerAndBoardArray[0] = tempPlayerArray[0]; - tempPlayerAndBoardArray[1] = tempPlayerArray[1]; - - (*it)->setMyCards(tempPlayerArray); - (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); - - (*it)->setMyBestHandPosition(temp5Array); - - // player4 - it++; - -// tempPlayerArray[0] = 25; -// tempPlayerArray[1] = 16; +// tempPlayerArray[0] = 12; +// tempPlayerArray[1] = 46; // tempPlayerAndBoardArray[0] = tempPlayerArray[0]; // tempPlayerAndBoardArray[1] = tempPlayerArray[1]; // @@ -191,11 +178,37 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI // // (*it)->setMyBestHandPosition(temp5Array); + // player4 + it++; + + tempPlayerArray[0] = 25; + tempPlayerArray[1] = 16; + tempPlayerAndBoardArray[0] = tempPlayerArray[0]; + tempPlayerAndBoardArray[1] = tempPlayerArray[1]; + + (*it)->setMyCards(tempPlayerArray); + (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); + + (*it)->setMyBestHandPosition(temp5Array); + + // player5 + it++; + + tempPlayerArray[0] = 43; + tempPlayerArray[1] = 30; + tempPlayerAndBoardArray[0] = tempPlayerArray[0]; + tempPlayerAndBoardArray[1] = tempPlayerArray[1]; + + (*it)->setMyCards(tempPlayerArray); + (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); + + (*it)->setMyBestHandPosition(temp5Array); + } break; case 2: { - tempBoardArray[0] = 48; +/* tempBoardArray[0] = 48; tempBoardArray[1] = 21; tempBoardArray[2] = 4; tempBoardArray[3] = 9; @@ -207,7 +220,7 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI tempPlayerAndBoardArray[3] = tempBoardArray[1]; tempPlayerAndBoardArray[4] = tempBoardArray[2]; tempPlayerAndBoardArray[5] = tempBoardArray[3]; - tempPlayerAndBoardArray[6] = tempBoardArray[4]; + tempPlayerAndBoardArray[6] = tempBoardArray[4];*/ // player0 it = seatsList->begin(); @@ -225,15 +238,15 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI // player1 it++; - tempPlayerArray[0] = 47; - tempPlayerArray[1] = 22; - tempPlayerAndBoardArray[0] = tempPlayerArray[0]; - tempPlayerAndBoardArray[1] = tempPlayerArray[1]; - - (*it)->setMyCards(tempPlayerArray); - (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); - - (*it)->setMyBestHandPosition(temp5Array); +// tempPlayerArray[0] = 47; +// tempPlayerArray[1] = 22; +// tempPlayerAndBoardArray[0] = tempPlayerArray[0]; +// tempPlayerAndBoardArray[1] = tempPlayerArray[1]; +// +// (*it)->setMyCards(tempPlayerArray); +// (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); +// +// (*it)->setMyBestHandPosition(temp5Array); // player2 it++; @@ -277,15 +290,15 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI // player5 it++; - tempPlayerArray[0] = 27; - tempPlayerArray[1] = 10; - tempPlayerAndBoardArray[0] = tempPlayerArray[0]; - tempPlayerAndBoardArray[1] = tempPlayerArray[1]; - - (*it)->setMyCards(tempPlayerArray); - (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); - - (*it)->setMyBestHandPosition(temp5Array); +// tempPlayerArray[0] = 27; +// tempPlayerArray[1] = 10; +// tempPlayerAndBoardArray[0] = tempPlayerArray[0]; +// tempPlayerAndBoardArray[1] = tempPlayerArray[1]; +// +// (*it)->setMyCards(tempPlayerArray); +// (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); +// +// (*it)->setMyBestHandPosition(temp5Array); } break; default: {} @@ -555,11 +568,18 @@ void LocalHand::switchRounds() { // exception - // no.1: if in first Preflop Round next player is small blind and only all-in-big-blind with less than smallblind amount is nonfold too -> preflop is over + // no.1: if in first Preflop Round next player is small blind and only all-in-big-blind with less than smallblind amount and other all-in players with less than small blind are nonfold too -> preflop is over PlayerListConstIterator smallBlindIt_c = getRunningPlayerIt(myBeRo[actualRound]->getSmallBlindPositionId()); PlayerListConstIterator bigBlindIt_c = getActivePlayerIt(myBeRo[actualRound]->getBigBlindPositionId()); - if(smallBlindIt_c!=runningPlayerList->end() && bigBlindIt_c!=activePlayerList->end() && actualRound == GAME_STATE_PREFLOP && myBeRo[actualRound]->getFirstRound() && nonFoldPlayerCounter == 2) { - if( (*bigBlindIt_c)->getMySet() <= smallBlind ) { + if(smallBlindIt_c!=runningPlayerList->end() && bigBlindIt_c!=activePlayerList->end() && actualRound == GAME_STATE_PREFLOP && myBeRo[actualRound]->getFirstRound()) { + // determine player who are all in with less than small blind amount + int tempCounter = 0; + for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) { + if((*it_c)->getMyAction() == PLAYER_ACTION_ALLIN && (*it_c)->getMySet() <= smallBlind) { + tempCounter++; + } + } + if( (*bigBlindIt_c)->getMySet() <= smallBlind && tempCounter == allInPlayersCounter) { allInCondition = true; } } diff --git a/src/engine/local_engine/localplayer.cpp b/src/engine/local_engine/localplayer.cpp index 27bd4cc3..7fe2cb64 100755 --- a/src/engine/local_engine/localplayer.cpp +++ b/src/engine/local_engine/localplayer.cpp @@ -860,22 +860,22 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq myCash=0; } break; case 1: { - myCash=104; + myCash=2520; } break; case 2: { - myCash=80; - } break; - case 3: { - myCash=1280; - } break; - case 4: { myCash=0; } break; + case 3: { + myCash=0; + } break; + case 4: { + myCash=14700; + } break; case 5: { - myCash=336; + myCash=3780; } break; case 6: { - // myCash=14800; + myCash=0; } break; default: { } @@ -1202,7 +1202,8 @@ void LocalPlayer::preflopEngine() { switch(actualHand->getMyID()) { case 1: { - myAction = PLAYER_ACTION_FOLD; + myAction = PLAYER_ACTION_RAISE; + raise = 3000; } break; case 2: { @@ -1221,7 +1222,7 @@ void LocalPlayer::preflopEngine() { switch(actualHand->getMyID()) { case 1: { - myAction = PLAYER_ACTION_FOLD; +// myAction = PLAYER_ACTION_FOLD; // raise = 20; // if(mySet >= 40) { // myAction = PLAYER_ACTION_CALL; @@ -1229,7 +1230,7 @@ void LocalPlayer::preflopEngine() { } break; case 2: { - myAction = PLAYER_ACTION_FOLD; +// myAction = PLAYER_ACTION_FOLD; // raise = 50; // if(mySet >= 70) { // myAction = PLAYER_ACTION_CALL; @@ -1245,7 +1246,7 @@ void LocalPlayer::preflopEngine() { case 3: { switch(actualHand->getMyID()) { case 1: { - myAction = PLAYER_ACTION_FOLD; +// myAction = PLAYER_ACTION_FOLD; // raise = 20; // if(mySet >= 40) { // myAction = PLAYER_ACTION_CALL; @@ -1253,7 +1254,7 @@ void LocalPlayer::preflopEngine() { } break; case 2: { - myAction = PLAYER_ACTION_FOLD; +// myAction = PLAYER_ACTION_FOLD; // raise = 50; // if(mySet >= 70) { // myAction = PLAYER_ACTION_CALL; @@ -1268,7 +1269,7 @@ void LocalPlayer::preflopEngine() { case 4: { switch(actualHand->getMyID()) { case 1: { -// myAction = PLAYER_ACTION_CALL; + myAction = PLAYER_ACTION_FOLD; // raise = 20; // if(mySet > 0) { // myAction = PLAYER_ACTION_FOLD; diff --git a/src/game.cpp b/src/game.cpp index bd70e2ec..0e09b08e 100755 --- a/src/game.cpp +++ b/src/game.cpp @@ -36,6 +36,11 @@ Game::Game(GuiInterface* gui, boost::shared_ptr factory, startHandsBeforeRaiseSmallBlind(gameData.handsBeforeRaise), myGameID(gameId), actualSmallBlind(gameData.smallBlind), actualHandID(0), dealerPosition(0), lastHandBlindsRaised(1), lastTimeBlindsRaised(0), myGameData(gameData) { + if(DEBUG_MODE) { + startSmallBlind = 5120; + actualSmallBlind = startSmallBlind; + } + // cout << "Create Game Object" << "\n"; int i;