adds activePlayerList and runningPlayerList (XIX): bugfixes

This commit is contained in:
doitux
2007-09-27 20:36:02 +00:00
parent 6d30e324e0
commit 73cf938496
5 changed files with 232 additions and 146 deletions
+20 -11
View File
@@ -212,18 +212,25 @@ void LocalBeRoPreflop::run() {
PlayerListConstIterator currentPlayersTurnConstIt;
// exceptions
// if next player is small blind and only all-in-big-blind with less than smallblind amount is nonfold too -> preflop is over
PlayerListConstIterator bigBlindPositionIt = getMyHand()->getActivePlayerIt(getBigBlindPositionId());
assert(bigBlindPositionIt != getMyHand()->getActivePlayerList()->end());
PlayerListConstIterator currentPlayersTurnConstIt = getMyHand()->getRunningPlayerIt( getCurrentPlayersTurnId() );
assert(currentPlayersTurnConstIt != getMyHand()->getRunningPlayerList()->end());
if((*currentPlayersTurnConstIt)->getMyButton() == BUTTON_SMALL_BLIND && (*bigBlindPositionIt)->getMySet() <= getSmallBlind() && getMyHand()->getRunningPlayerList()->size() == 1) {
setFirstRound(false);
allHighestSet = true;
// 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
if(getFirstRound()) {
PlayerListConstIterator bigBlindPositionIt = getMyHand()->getActivePlayerIt(getBigBlindPositionId());
assert(bigBlindPositionIt != getMyHand()->getActivePlayerList()->end());
currentPlayersTurnConstIt = getMyHand()->getRunningPlayerIt( getCurrentPlayersTurnId() );
assert(currentPlayersTurnConstIt != getMyHand()->getRunningPlayerList()->end());
int nonFoldPlayerCounter = 0;
for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); it_c++) {
if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonFoldPlayerCounter++;
}
if((*currentPlayersTurnConstIt)->getMyButton() == BUTTON_SMALL_BLIND && (*bigBlindPositionIt)->getMySet() <= getSmallBlind() && nonFoldPlayerCounter == 2) {
setFirstRound(false);
allHighestSet = true;
}
}
@@ -301,6 +308,8 @@ void LocalBeRoPreflop::run() {
// getMyHand()->getPlayerArray()[getPlayersTurn()]->setMyTurn(1);
currentPlayersTurnConstIt = getMyHand()->getRunningPlayerIt( getCurrentPlayersTurnId() );
assert(currentPlayersTurnConstIt != getMyHand()->getRunningPlayerList()->end());
(*currentPlayersTurnConstIt)->setMyTurn(true);
// (*(getCurrentPlayersTurnIt()))->setMyTurn(true);
+128 -105
View File
@@ -106,151 +106,174 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
if(DEBUG_MODE) {
// int temp5Array[5];
int temp5Array[5];
switch(myID) {
case 1: {
case 1: {
tempBoardArray[0] = 40;
tempBoardArray[1] = 21;
tempBoardArray[2] = 45;
tempBoardArray[3] = 43;
tempBoardArray[4] = 50;
myBoard->setMyCards(tempBoardArray);
tempPlayerAndBoardArray[2] = tempBoardArray[0];
tempPlayerAndBoardArray[3] = tempBoardArray[1];
tempPlayerAndBoardArray[4] = tempBoardArray[2];
tempPlayerAndBoardArray[5] = tempBoardArray[3];
tempPlayerAndBoardArray[6] = tempBoardArray[4];
// 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++;
// tempBoardArray[0] = 5;
// tempBoardArray[1] = 51;
// tempBoardArray[2] = 3;
// tempBoardArray[3] = 21;
// tempBoardArray[4] = 13;
//
// myBoard->setMyCards(tempBoardArray);
//
// tempPlayerAndBoardArray[2] = tempBoardArray[0];
// tempPlayerAndBoardArray[3] = tempBoardArray[1];
// tempPlayerAndBoardArray[4] = tempBoardArray[2];
// tempPlayerAndBoardArray[5] = tempBoardArray[3];
// tempPlayerAndBoardArray[6] = tempBoardArray[4];
//
// // player0
//
// tempPlayerArray[0] = 7;
// tempPlayerArray[1] = 37;
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
//
// playerArray[0]->setMyCards(tempPlayerArray);
// playerArray[0]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
//
// playerArray[0]->setMyBestHandPosition(temp5Array);
//
// // player1
//
// tempPlayerArray[0] = 24;
// tempPlayerArray[1] = 19;
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
//
// playerArray[1]->setMyCards(tempPlayerArray);
// playerArray[1]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
// (*it)->setMyCards(tempPlayerArray);
// (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
//
// playerArray[1]->setMyBestHandPosition(temp5Array);
// (*it)->setMyBestHandPosition(temp5Array);
// player2
it++;
/* tempPlayerArray[0] = 25;
tempPlayerArray[1] = 36;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
playerArray[2]->setMyCards(tempPlayerArray);
playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
playerArray[2]->setMyBestHandPosition(temp5Array);*/
// player3
// tempPlayerArray[0] = 38;
// tempPlayerArray[1] = 22;
// tempPlayerArray[0] = 25;
// tempPlayerArray[1] = 36;
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
//
// playerArray[3]->setMyCards(tempPlayerArray);
// playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
// (*it)->setMyCards(tempPlayerArray);
// (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
//
// playerArray[3]->setMyBestHandPosition(temp5Array);
// (*it)->setMyBestHandPosition(temp5Array);
// 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;
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
//
// playerArray[3]->setMyCards(tempPlayerArray);
// playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
// (*it)->setMyCards(tempPlayerArray);
// (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
//
// playerArray[3]->setMyBestHandPosition(temp5Array);
// (*it)->setMyBestHandPosition(temp5Array);
} break;
case 2: {
// tempBoardArray[0] = 32;
// tempBoardArray[1] = 26;
// tempBoardArray[2] = 28;
// tempBoardArray[3] = 38;
// tempBoardArray[4] = 7;
//
// myBoard->setMyCards(tempBoardArray);
//
// tempPlayerAndBoardArray[2] = tempBoardArray[0];
// tempPlayerAndBoardArray[3] = tempBoardArray[1];
// tempPlayerAndBoardArray[4] = tempBoardArray[2];
// tempPlayerAndBoardArray[5] = tempBoardArray[3];
// tempPlayerAndBoardArray[6] = tempBoardArray[4];
//
// // player0
//
// tempPlayerArray[0] = 45;
// tempPlayerArray[1] = 35;
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
//
// playerArray[0]->setMyCards(tempPlayerArray);
// playerArray[0]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
//
// playerArray[0]->setMyBestHandPosition(temp5Array);
//
// // player1
//
// tempPlayerArray[0] = 34;
// tempPlayerArray[1] = 39;
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
//
// playerArray[1]->setMyCards(tempPlayerArray);
// playerArray[1]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
//
// playerArray[1]->setMyBestHandPosition(temp5Array);
tempBoardArray[0] = 41;
tempBoardArray[1] = 51;
tempBoardArray[2] = 6;
tempBoardArray[3] = 26;
tempBoardArray[4] = 11;
// // player2
//
// tempPlayerArray[0] = 7;
// tempPlayerArray[1] = 17;
myBoard->setMyCards(tempBoardArray);
tempPlayerAndBoardArray[2] = tempBoardArray[0];
tempPlayerAndBoardArray[3] = tempBoardArray[1];
tempPlayerAndBoardArray[4] = tempBoardArray[2];
tempPlayerAndBoardArray[5] = tempBoardArray[3];
tempPlayerAndBoardArray[6] = tempBoardArray[4];
// player0
it = seatsList->begin();
tempPlayerArray[0] = 9;
tempPlayerArray[1] = 5;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
(*it)->setMyCards(tempPlayerArray);
(*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
(*it)->setMyBestHandPosition(temp5Array);
// player1
it++;
tempPlayerArray[0] = 15;
tempPlayerArray[1] = 10;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
(*it)->setMyCards(tempPlayerArray);
(*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
(*it)->setMyBestHandPosition(temp5Array);
// player2
it++;
tempPlayerArray[0] = 33;
tempPlayerArray[1] = 27;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
(*it)->setMyCards(tempPlayerArray);
(*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
(*it)->setMyBestHandPosition(temp5Array);
// player3
it++;
// tempPlayerArray[0] = 38;
// tempPlayerArray[1] = 22;
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
//
// playerArray[2]->setMyCards(tempPlayerArray);
// playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
// (*it)->setMyCards(tempPlayerArray);
// (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
//
// playerArray[2]->setMyBestHandPosition(temp5Array);
//
// // player3
//
// tempPlayerArray[0] = 26;
// tempPlayerArray[1] = 28;
// (*it)->setMyBestHandPosition(temp5Array);
// player4
it++;
// tempPlayerArray[0] = 25;
// tempPlayerArray[1] = 16;
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
//
// playerArray[3]->setMyCards(tempPlayerArray);
// playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
// (*it)->setMyCards(tempPlayerArray);
// (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
//
// playerArray[3]->setMyBestHandPosition(temp5Array);
// (*it)->setMyBestHandPosition(temp5Array);
} break;
default: {}
+81 -27
View File
@@ -853,26 +853,40 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
// !!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!!
if(DEBUG_MODE) {
switch(myUniqueID) {
if(myID==0) {
// myActiveStatus=0;
// myCash=14800;
}
if(myID==1) {
// myCash=400;
}
if(myID==2) {
myCash=50;
}
if(myID==3) {
// myCash=5250;
}
if(myID==4) {
// myCash=5100;
}
if(myID==5) {
// myCash=4500;
case 0: {
// myActiveStatus=0;
myCash=4600;
} break;
case 1: {
// myActiveStatus=0;
myCash=4400;
} break;
case 2: {
// myActiveStatus=0;
myCash=800;
} break;
case 3: {
// myActiveStatus=0;
myCash=4000;
} break;
case 4: {
// myActiveStatus=0;
myCash=4200;
} break;
case 5: {
// myActiveStatus=0;
// myCash=14800;
} break;
case 6: {
// myActiveStatus=0;
// myCash=14800;
} break;
default: {
}
}
}
@@ -1187,14 +1201,15 @@ void LocalPlayer::preflopEngine() {
// cout << myID << ": " << myOdds << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << "Bluff: " << sBluffStatus << endl;
if(DEBUG_MODE) {
switch(myID) {
switch(myUniqueID) {
case 0: {}
break;
case 1: {
// player 1
switch(actualHand->getMyID()) {
case 1: {
// myAction = PLAYER_ACTION_CALL;
myAction = PLAYER_ACTION_FOLD;
}
break;
case 2: {
@@ -1209,10 +1224,11 @@ void LocalPlayer::preflopEngine() {
}
break;
case 2: {
// player 2
switch(actualHand->getMyID()) {
case 1: {
// myAction = PLAYER_ACTION_FOLD;
myAction = PLAYER_ACTION_FOLD;
// raise = 20;
// if(mySet >= 40) {
// myAction = PLAYER_ACTION_CALL;
@@ -1234,11 +1250,49 @@ void LocalPlayer::preflopEngine() {
}
break;
case 3: {
// myAction = PLAYER_ACTION_CALL;
switch(actualHand->getMyID()) {
case 1: {
myAction = PLAYER_ACTION_CALL;
// raise = 20;
// if(mySet >= 40) {
// myAction = PLAYER_ACTION_CALL;
// }
}
break;
case 2: {
// myAction = PLAYER_ACTION_RAISE;
// raise = 50;
// if(mySet >= 70) {
// myAction = PLAYER_ACTION_CALL;
// }
}
break;
default: {
}
}
}
break;
case 4: {
// myAction = PLAYER_ACTION_CALL;
switch(actualHand->getMyID()) {
case 1: {
myAction = PLAYER_ACTION_CALL;
// raise = 20;
if(mySet > 0) {
myAction = PLAYER_ACTION_FOLD;
}
}
break;
case 2: {
myAction = PLAYER_ACTION_FOLD;
// raise = 50;
// if(mySet >= 70) {
// myAction = PLAYER_ACTION_CALL;
// }
}
break;
default: {
}
}
}
break;
case 5: {
@@ -1508,7 +1562,7 @@ void LocalPlayer::flopEngine() {
if(DEBUG_MODE) {
switch(myID) {
switch(myUniqueID) {
case 0: {
} break;
case 1: {
@@ -2100,7 +2154,7 @@ void LocalPlayer::turnEngine() {
if(DEBUG_MODE) {
switch(myID) {
switch(myUniqueID) {
case 0: {
}
@@ -2438,7 +2492,7 @@ void LocalPlayer::riverEngine() {
if(DEBUG_MODE) {
switch(myID) {
switch(myUniqueID) {
case 0: {
} break;
case 1: {
+2 -2
View File
@@ -1025,7 +1025,7 @@ QStringList Log::translateCardsValueCode(int cardsValueCode) {
break;
// Pair
case 1: {
cardString << "Pair, ";
cardString << "One Pair, ";
// Pair
switch(secondPart) {
case 12: cardString << "Aces";
@@ -1150,7 +1150,7 @@ QStringList Log::translateCardsValueCode(int cardsValueCode) {
break;
// Highest Card
case 0: {
cardString << "Highest Card, ";
cardString << "High Card, ";
// Kicker 1
switch(secondPart) {
case 12: cardString << "Ace";
+1 -1
View File
@@ -738,7 +738,7 @@ void mainWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
startData.numberOfPlayers = gameData.maxNumberOfPlayers;
Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0);
if(DEBUG_MODE) {
tmpDealerPos = 1;
tmpDealerPos = 4;
}
startData.startDealerPlayerId = static_cast<unsigned>(tmpDealerPos);