adds activePlayerList and runningPlayerList (XX) - bugfixes

This commit is contained in:
doitux
2007-09-28 00:16:11 +00:00
parent eb62635e02
commit 4728967f97
6 changed files with 110 additions and 66 deletions
+4
View File
@@ -37,6 +37,9 @@ public:
virtual void setCurrentPlayersTurnIt(PlayerListIterator) =0;
virtual PlayerListIterator getCurrentPlayersTurnIt() const =0;
virtual unsigned getSmallBlindPositionId() const =0;
virtual unsigned getBigBlindPositionId() const =0;
virtual void setHighestSet(int) =0;
virtual int getHighestSet() const =0;
@@ -50,6 +53,7 @@ public:
virtual void setMinimumRaise (int) =0;
virtual int getMinimumRaise() const =0;
virtual bool getFirstRound() const =0;
virtual void resetFirstRun() =0;
+22 -18
View File
@@ -214,24 +214,25 @@ void LocalBeRoPreflop::run() {
PlayerListConstIterator currentPlayersTurnConstIt;
// exceptions
// 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;
}
}
// 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
// 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;
// getMyHand()->setAllInCondition(true);
// }
// }
@@ -267,6 +268,9 @@ void LocalBeRoPreflop::run() {
// Preflop nicht dran, weil wir nicht mehr in erster PreflopRunde und alle Sets gleich sind
//also gehe in Flop
getMyHand()->setActualRound(GAME_STATE_FLOP);
// exception no.1 - see above
// if(getMyHand()->getAllInCondition()) getMyHand()->setActualRound(GAME_STATE_PREFLOP);;
//Action loeschen und ActionButtons refresh
for(it_c=getMyHand()->getRunningPlayerList()->begin(); it_c!=getMyHand()->getRunningPlayerList()->end(); it_c++) {
+52 -27
View File
@@ -195,11 +195,11 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
} break;
case 2: {
tempBoardArray[0] = 41;
tempBoardArray[1] = 51;
tempBoardArray[2] = 6;
tempBoardArray[3] = 26;
tempBoardArray[4] = 11;
tempBoardArray[0] = 48;
tempBoardArray[1] = 21;
tempBoardArray[2] = 4;
tempBoardArray[3] = 9;
tempBoardArray[4] = 0;
myBoard->setMyCards(tempBoardArray);
@@ -212,21 +212,21 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// 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);
// 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;
tempPlayerArray[0] = 47;
tempPlayerArray[1] = 22;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -238,15 +238,15 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// 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);
// 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++;
@@ -274,6 +274,18 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
//
// (*it)->setMyBestHandPosition(temp5Array);
// 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);
} break;
default: {}
@@ -522,7 +534,7 @@ void LocalHand::switchRounds() {
for(it_c=runningPlayerList->begin(); it_c!=runningPlayerList->end(); it_c++) {
if((*it_c)->getMySet() >= myBeRo[actualRound]->getHighestSet()) {
allInCondition = 1;
allInCondition = true;
}
}
@@ -542,11 +554,24 @@ 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
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 ) {
allInCondition = true;
}
}
// HeadsUp-Ausnahme -> spieler ermitteln, der all in ist und als bb nur weniger als sb setzen konnte
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
if(activePlayerList->size()==2 && (*it_c)->getMyAction() == PLAYER_ACTION_ALLIN && (*it_c)->getMyButton()==BUTTON_BIG_BLIND && (*it_c)->getMySet()<=smallBlind) {
allInCondition = 1;
allInCondition = true;
}
}
+14 -21
View File
@@ -857,31 +857,24 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
switch(myUniqueID) {
case 0: {
// myActiveStatus=0;
myCash=4600;
myCash=0;
} break;
case 1: {
// myActiveStatus=0;
myCash=4400;
myCash=104;
} break;
case 2: {
// myActiveStatus=0;
myCash=800;
myCash=80;
} break;
case 3: {
// myActiveStatus=0;
myCash=4000;
myCash=1280;
} break;
case 4: {
// myActiveStatus=0;
myCash=4200;
myCash=0;
} break;
case 5: {
// myActiveStatus=0;
// myCash=14800;
myCash=336;
} break;
case 6: {
// myActiveStatus=0;
// myCash=14800;
} break;
default: {
@@ -1236,7 +1229,7 @@ void LocalPlayer::preflopEngine() {
}
break;
case 2: {
// myAction = PLAYER_ACTION_RAISE;
myAction = PLAYER_ACTION_FOLD;
// raise = 50;
// if(mySet >= 70) {
// myAction = PLAYER_ACTION_CALL;
@@ -1252,7 +1245,7 @@ void LocalPlayer::preflopEngine() {
case 3: {
switch(actualHand->getMyID()) {
case 1: {
myAction = PLAYER_ACTION_CALL;
myAction = PLAYER_ACTION_FOLD;
// raise = 20;
// if(mySet >= 40) {
// myAction = PLAYER_ACTION_CALL;
@@ -1260,7 +1253,7 @@ void LocalPlayer::preflopEngine() {
}
break;
case 2: {
// myAction = PLAYER_ACTION_RAISE;
myAction = PLAYER_ACTION_FOLD;
// raise = 50;
// if(mySet >= 70) {
// myAction = PLAYER_ACTION_CALL;
@@ -1275,15 +1268,15 @@ void LocalPlayer::preflopEngine() {
case 4: {
switch(actualHand->getMyID()) {
case 1: {
myAction = PLAYER_ACTION_CALL;
// myAction = PLAYER_ACTION_CALL;
// raise = 20;
if(mySet > 0) {
myAction = PLAYER_ACTION_FOLD;
}
// if(mySet > 0) {
// myAction = PLAYER_ACTION_FOLD;
// }
}
break;
case 2: {
myAction = PLAYER_ACTION_FOLD;
// myAction = PLAYER_ACTION_FOLD;
// raise = 50;
// if(mySet >= 70) {
// myAction = PLAYER_ACTION_CALL;
+12
View File
@@ -97,6 +97,18 @@ ClientBeRo::getLastPlayersTurnIt() const
return lastPlayersTurnIt;
}
unsigned
ClientBeRo::getSmallBlindPositionId() const
{
return smallBlindPositionId;
}
unsigned
ClientBeRo::getBigBlindPositionId() const
{
return bigBlindPositionId;
}
void
ClientBeRo::setCurrentPlayersTurnId(unsigned theValue)
{
+6
View File
@@ -36,6 +36,9 @@ public:
void setPlayersTurn(int theValue);
int getPlayersTurn() const;
unsigned getSmallBlindPositionId() const;
unsigned getBigBlindPositionId() const;
void setCurrentPlayersTurnId(unsigned theValue);
unsigned getCurrentPlayersTurnId() const;
@@ -85,6 +88,9 @@ private:
PlayerListIterator currentPlayersTurnIt; // iterator for runningPlayerList
PlayerListIterator lastPlayersTurnIt; // iterator for runningPlayerList
unsigned smallBlindPositionId;
unsigned bigBlindPositionId;
unsigned currentPlayersTurnId;
unsigned firstRoundLastPlayersTurnId;