adds activePlayerList and runningPlayerList (XXI) - bugfixes

This commit is contained in:
doitux
2007-09-28 15:04:52 +00:00
parent 45d71f0866
commit eec7e6c097
3 changed files with 98 additions and 72 deletions
+77 -57
View File
@@ -112,11 +112,11 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
case 1: { case 1: {
tempBoardArray[0] = 40; tempBoardArray[0] = 27;
tempBoardArray[1] = 21; tempBoardArray[1] = 37;
tempBoardArray[2] = 45; tempBoardArray[2] = 45;
tempBoardArray[3] = 43; tempBoardArray[3] = 51;
tempBoardArray[4] = 50; tempBoardArray[4] = 23;
myBoard->setMyCards(tempBoardArray); myBoard->setMyCards(tempBoardArray);
@@ -129,21 +129,8 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player0 // player0
it = seatsList->begin(); it = seatsList->begin();
tempPlayerArray[0] = 51; // tempPlayerArray[0] = 51;
tempPlayerArray[1] = 20; // 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;
// tempPlayerAndBoardArray[0] = tempPlayerArray[0]; // tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// tempPlayerAndBoardArray[1] = tempPlayerArray[1]; // tempPlayerAndBoardArray[1] = tempPlayerArray[1];
// //
@@ -152,6 +139,19 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// //
// (*it)->setMyBestHandPosition(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 // player2
it++; it++;
@@ -168,21 +168,8 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player3 // player3
it++; it++;
tempPlayerArray[0] = 12; // tempPlayerArray[0] = 12;
tempPlayerArray[1] = 46; // 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;
// tempPlayerAndBoardArray[0] = tempPlayerArray[0]; // tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// tempPlayerAndBoardArray[1] = tempPlayerArray[1]; // tempPlayerAndBoardArray[1] = tempPlayerArray[1];
// //
@@ -191,11 +178,37 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// //
// (*it)->setMyBestHandPosition(temp5Array); // (*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; } break;
case 2: { case 2: {
tempBoardArray[0] = 48; /* tempBoardArray[0] = 48;
tempBoardArray[1] = 21; tempBoardArray[1] = 21;
tempBoardArray[2] = 4; tempBoardArray[2] = 4;
tempBoardArray[3] = 9; tempBoardArray[3] = 9;
@@ -207,7 +220,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
tempPlayerAndBoardArray[3] = tempBoardArray[1]; tempPlayerAndBoardArray[3] = tempBoardArray[1];
tempPlayerAndBoardArray[4] = tempBoardArray[2]; tempPlayerAndBoardArray[4] = tempBoardArray[2];
tempPlayerAndBoardArray[5] = tempBoardArray[3]; tempPlayerAndBoardArray[5] = tempBoardArray[3];
tempPlayerAndBoardArray[6] = tempBoardArray[4]; tempPlayerAndBoardArray[6] = tempBoardArray[4];*/
// player0 // player0
it = seatsList->begin(); it = seatsList->begin();
@@ -225,15 +238,15 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player1 // player1
it++; it++;
tempPlayerArray[0] = 47; // tempPlayerArray[0] = 47;
tempPlayerArray[1] = 22; // tempPlayerArray[1] = 22;
tempPlayerAndBoardArray[0] = tempPlayerArray[0]; // tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1]; // tempPlayerAndBoardArray[1] = tempPlayerArray[1];
//
(*it)->setMyCards(tempPlayerArray); // (*it)->setMyCards(tempPlayerArray);
(*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); // (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
//
(*it)->setMyBestHandPosition(temp5Array); // (*it)->setMyBestHandPosition(temp5Array);
// player2 // player2
it++; it++;
@@ -277,15 +290,15 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player5 // player5
it++; it++;
tempPlayerArray[0] = 27; // tempPlayerArray[0] = 27;
tempPlayerArray[1] = 10; // tempPlayerArray[1] = 10;
tempPlayerAndBoardArray[0] = tempPlayerArray[0]; // tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1]; // tempPlayerAndBoardArray[1] = tempPlayerArray[1];
//
(*it)->setMyCards(tempPlayerArray); // (*it)->setMyCards(tempPlayerArray);
(*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array)); // (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
//
(*it)->setMyBestHandPosition(temp5Array); // (*it)->setMyBestHandPosition(temp5Array);
} break; } break;
default: {} default: {}
@@ -555,11 +568,18 @@ void LocalHand::switchRounds() {
// exception // 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 smallBlindIt_c = getRunningPlayerIt(myBeRo[actualRound]->getSmallBlindPositionId());
PlayerListConstIterator bigBlindIt_c = getActivePlayerIt(myBeRo[actualRound]->getBigBlindPositionId()); 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(smallBlindIt_c!=runningPlayerList->end() && bigBlindIt_c!=activePlayerList->end() && actualRound == GAME_STATE_PREFLOP && myBeRo[actualRound]->getFirstRound()) {
if( (*bigBlindIt_c)->getMySet() <= smallBlind ) { // 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; allInCondition = true;
} }
} }
+16 -15
View File
@@ -860,22 +860,22 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
myCash=0; myCash=0;
} break; } break;
case 1: { case 1: {
myCash=104; myCash=2520;
} break; } break;
case 2: { case 2: {
myCash=80;
} break;
case 3: {
myCash=1280;
} break;
case 4: {
myCash=0; myCash=0;
} break; } break;
case 3: {
myCash=0;
} break;
case 4: {
myCash=14700;
} break;
case 5: { case 5: {
myCash=336; myCash=3780;
} break; } break;
case 6: { case 6: {
// myCash=14800; myCash=0;
} break; } break;
default: { default: {
} }
@@ -1202,7 +1202,8 @@ void LocalPlayer::preflopEngine() {
switch(actualHand->getMyID()) { switch(actualHand->getMyID()) {
case 1: { case 1: {
myAction = PLAYER_ACTION_FOLD; myAction = PLAYER_ACTION_RAISE;
raise = 3000;
} }
break; break;
case 2: { case 2: {
@@ -1221,7 +1222,7 @@ void LocalPlayer::preflopEngine() {
switch(actualHand->getMyID()) { switch(actualHand->getMyID()) {
case 1: { case 1: {
myAction = PLAYER_ACTION_FOLD; // myAction = PLAYER_ACTION_FOLD;
// raise = 20; // raise = 20;
// if(mySet >= 40) { // if(mySet >= 40) {
// myAction = PLAYER_ACTION_CALL; // myAction = PLAYER_ACTION_CALL;
@@ -1229,7 +1230,7 @@ void LocalPlayer::preflopEngine() {
} }
break; break;
case 2: { case 2: {
myAction = PLAYER_ACTION_FOLD; // myAction = PLAYER_ACTION_FOLD;
// raise = 50; // raise = 50;
// if(mySet >= 70) { // if(mySet >= 70) {
// myAction = PLAYER_ACTION_CALL; // myAction = PLAYER_ACTION_CALL;
@@ -1245,7 +1246,7 @@ void LocalPlayer::preflopEngine() {
case 3: { case 3: {
switch(actualHand->getMyID()) { switch(actualHand->getMyID()) {
case 1: { case 1: {
myAction = PLAYER_ACTION_FOLD; // myAction = PLAYER_ACTION_FOLD;
// raise = 20; // raise = 20;
// if(mySet >= 40) { // if(mySet >= 40) {
// myAction = PLAYER_ACTION_CALL; // myAction = PLAYER_ACTION_CALL;
@@ -1253,7 +1254,7 @@ void LocalPlayer::preflopEngine() {
} }
break; break;
case 2: { case 2: {
myAction = PLAYER_ACTION_FOLD; // myAction = PLAYER_ACTION_FOLD;
// raise = 50; // raise = 50;
// if(mySet >= 70) { // if(mySet >= 70) {
// myAction = PLAYER_ACTION_CALL; // myAction = PLAYER_ACTION_CALL;
@@ -1268,7 +1269,7 @@ void LocalPlayer::preflopEngine() {
case 4: { case 4: {
switch(actualHand->getMyID()) { switch(actualHand->getMyID()) {
case 1: { case 1: {
// myAction = PLAYER_ACTION_CALL; myAction = PLAYER_ACTION_FOLD;
// raise = 20; // raise = 20;
// if(mySet > 0) { // if(mySet > 0) {
// myAction = PLAYER_ACTION_FOLD; // myAction = PLAYER_ACTION_FOLD;
+5
View File
@@ -36,6 +36,11 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
startHandsBeforeRaiseSmallBlind(gameData.handsBeforeRaise), startHandsBeforeRaiseSmallBlind(gameData.handsBeforeRaise),
myGameID(gameId), actualSmallBlind(gameData.smallBlind), actualHandID(0), dealerPosition(0), lastHandBlindsRaised(1), lastTimeBlindsRaised(0), myGameData(gameData) 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"; // cout << "Create Game Object" << "\n";
int i; int i;