full bet rule (part 1)

This commit is contained in:
floty
2010-01-02 18:10:36 +00:00
parent 62592336b7
commit 8bafd61f3c
9 changed files with 259 additions and 76 deletions
+3
View File
@@ -64,6 +64,9 @@ public:
virtual void setMinimumRaise (int) =0; virtual void setMinimumRaise (int) =0;
virtual int getMinimumRaise() const =0; virtual int getMinimumRaise() const =0;
virtual void setFullBetRule (bool) =0;
virtual bool getFullBetRule() const =0;
virtual bool getFirstRound() const =0; virtual bool getFirstRound() const =0;
virtual void skipFirstRunGui() =0; virtual void skipFirstRunGui() =0;
+1 -1
View File
@@ -26,7 +26,7 @@
using namespace std; using namespace std;
LocalBeRo::LocalBeRo(HandInterface* hi, int id, unsigned dP, int sB, GameState gS) LocalBeRo::LocalBeRo(HandInterface* hi, int id, unsigned dP, int sB, GameState gS)
: BeRoInterface(), myHand(hi), myBeRoID(gS), myID(id), dealerPosition(dP), smallBlindPosition(0), dealerPositionId(dP), smallBlindPositionId(0), bigBlindPositionId(0), smallBlind(sB), highestSet(0), minimumRaise(2*sB), firstRun(true), firstRunGui(true), firstRound(true), firstHeadsUpRound(true), currentPlayersTurnId(0), firstRoundLastPlayersTurnId(0), logBoardCardsDone(false) : BeRoInterface(), myHand(hi), myBeRoID(gS), myID(id), dealerPosition(dP), smallBlindPosition(0), dealerPositionId(dP), smallBlindPositionId(0), bigBlindPositionId(0), smallBlind(sB), highestSet(0), minimumRaise(2*sB), fullBetRule(false), firstRun(true), firstRunGui(true), firstRound(true), firstHeadsUpRound(true), currentPlayersTurnId(0), firstRoundLastPlayersTurnId(0), logBoardCardsDone(false)
{ {
currentPlayersTurnIt = myHand->getRunningPlayerList()->begin(); currentPlayersTurnIt = myHand->getRunningPlayerList()->begin();
lastPlayersTurnIt = myHand->getRunningPlayerList()->begin(); lastPlayersTurnIt = myHand->getRunningPlayerList()->begin();
+4
View File
@@ -39,6 +39,9 @@ public:
void setMinimumRaise ( int theValue ) { minimumRaise = theValue; } void setMinimumRaise ( int theValue ) { minimumRaise = theValue; }
int getMinimumRaise() const { return minimumRaise; } int getMinimumRaise() const { return minimumRaise; }
void setFullBetRule ( bool theValue ) { fullBetRule = theValue; }
bool getFullBetRule() const { return fullBetRule; }
void skipFirstRunGui() { firstRunGui = false; } void skipFirstRunGui() { firstRunGui = false; }
void nextPlayer(); void nextPlayer();
@@ -118,6 +121,7 @@ private:
int smallBlind; int smallBlind;
int highestSet; int highestSet;
int minimumRaise; int minimumRaise;
bool fullBetRule;
bool firstRun; bool firstRun;
bool firstRunGui; // HACK bool firstRunGui; // HACK
+42 -29
View File
@@ -104,11 +104,11 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
case 1: { case 1: {
tempBoardArray[0] = 48; tempBoardArray[0] = 21;
tempBoardArray[1] = 10; tempBoardArray[1] = 8;
tempBoardArray[2] = 11; tempBoardArray[2] = 50;
tempBoardArray[3] = 1; tempBoardArray[3] = 11;
tempBoardArray[4] = 26; tempBoardArray[4] = 16;
myBoard->setMyCards(tempBoardArray); myBoard->setMyCards(tempBoardArray);
@@ -121,8 +121,8 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player0 // player0
it = seatsList->begin(); it = seatsList->begin();
tempPlayerArray[0] = 24; tempPlayerArray[0] = 30;
tempPlayerArray[1] = 45; tempPlayerArray[1] = 37;
tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1]; tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -134,8 +134,8 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player1 // player1
it++; it++;
tempPlayerArray[0] = 38; tempPlayerArray[0] = 38;
tempPlayerArray[1] = 27; tempPlayerArray[1] = 25;
tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1]; tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -160,15 +160,15 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player3 // player3
it++; it++;
// tempPlayerArray[0] = 12; tempPlayerArray[0] = 36;
// tempPlayerArray[1] = 46; tempPlayerArray[1] = 47;
// 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);
// player4 // player4
it++; it++;
@@ -186,21 +186,21 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player5 // player5
it++; it++;
// tempPlayerArray[0] = 43; tempPlayerArray[0] = 43;
// tempPlayerArray[1] = 30; tempPlayerArray[1] = 30;
// 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);
// player6 // player6
it++; it++;
tempPlayerArray[0] = 31; tempPlayerArray[0] = 24;
tempPlayerArray[1] = 19; tempPlayerArray[1] = 6;
tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1]; tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -209,6 +209,19 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
(*it)->setMyBestHandPosition(temp5Array); (*it)->setMyBestHandPosition(temp5Array);
// player7
it++;
tempPlayerArray[0] = 31;
tempPlayerArray[1] = 19;
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: {
+190 -43
View File
@@ -859,25 +859,25 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
switch(myUniqueID) { switch(myUniqueID) {
case 0: { case 0: {
myCash=23110; myCash=2765;
} break; } break;
case 1: { case 1: {
myCash=1320; myCash=50;
} break; } break;
case 2: { case 2: {
myCash=0; myCash=100;
} break; } break;
case 3: { case 3: {
myCash=0; myCash=0;
} break; } break;
case 4: { case 4: {
myCash=0; myCash=0;
} break; } break;
case 5: { case 5: {
myCash=0; myCash=0;
} break; } break;
case 6: { case 6: {
myCash=0; myCash=0;
} break; } break;
case 7: { case 7: {
myCash=0; myCash=0;
@@ -928,6 +928,51 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
} }
myDude4 = (myDude4/count)-interval; myDude4 = (myDude4/count)-interval;
// !!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!!
if(DEBUG_MODE) {
switch(myUniqueID) {
case 0: {
// myDude4=0;
} break;
case 1: {
myDude4=-20;
} break;
case 2: {
// myDude4=0;
} break;
case 3: {
// myDude4=0;
} break;
case 4: {
// myDude4=0;
} break;
case 5: {
// myDude4=0;
} break;
case 6: {
// myDude4=0;
} break;
case 7: {
// myDude4=0;
} break;
case 8: {
// myDude4=0;
} break;
case 9: {
// myDude4=0;
} break;
default: {
}
}
}
////////////////////////////
delete[] tempArray; delete[] tempArray;
myCardsValue = new CardsValue; myCardsValue = new CardsValue;
@@ -1287,8 +1332,8 @@ void LocalPlayer::preflopEngine() {
switch(currentHand->getMyID()) { switch(currentHand->getMyID()) {
case 1: { case 1: {
myAction = PLAYER_ACTION_CHECK; myAction = PLAYER_ACTION_RAISE;
// raise = 3000; raise = 20;
} }
break; break;
case 2: { case 2: {
@@ -1307,8 +1352,8 @@ void LocalPlayer::preflopEngine() {
switch(currentHand->getMyID()) { switch(currentHand->getMyID()) {
case 1: { case 1: {
myAction = PLAYER_ACTION_CALL; myAction = PLAYER_ACTION_RAISE;
// raise = 20; raise = 20;
// if(mySet >= 40) { // if(mySet >= 40) {
// myAction = PLAYER_ACTION_CALL; // myAction = PLAYER_ACTION_CALL;
// } // }
@@ -1331,7 +1376,7 @@ void LocalPlayer::preflopEngine() {
case 3: { case 3: {
switch(currentHand->getMyID()) { switch(currentHand->getMyID()) {
case 1: { case 1: {
myAction = PLAYER_ACTION_FOLD; myAction = PLAYER_ACTION_CALL;
// raise = 20; // raise = 20;
// if(mySet >= 40) { // if(mySet >= 40) {
// myAction = PLAYER_ACTION_CALL; // myAction = PLAYER_ACTION_CALL;
@@ -1376,7 +1421,7 @@ void LocalPlayer::preflopEngine() {
break; break;
case 5: { case 5: {
// if(mySet == 0) { // if(mySet == 0) {
myAction = PLAYER_ACTION_CALL; myAction = PLAYER_ACTION_CHECK;
// } // }
} }
break; break;
@@ -1722,8 +1767,8 @@ void LocalPlayer::flopEngine() {
case 3: { case 3: {
switch(currentHand->getMyID()) { switch(currentHand->getMyID()) {
case 1: { case 1: {
// myAction = PLAYER_ACTION_BET; myAction = PLAYER_ACTION_RAISE;
// bet = 80; raise = 400;
// if(currentHand->getCurrentBeRo()->getHighestSet() > 0) { // if(currentHand->getCurrentBeRo()->getHighestSet() > 0) {
// myAction = PLAYER_ACTION_CALL; // myAction = PLAYER_ACTION_CALL;
// } // }
@@ -1747,11 +1792,11 @@ void LocalPlayer::flopEngine() {
case 4: { case 4: {
switch(currentHand->getMyID()) { switch(currentHand->getMyID()) {
case 1: { case 1: {
myAction = PLAYER_ACTION_CHECK; myAction = PLAYER_ACTION_BET;
// bet = 80; bet = 40;
// if(currentHand->getCurrentBeRo()->getHighestSet() > 0) { if(currentHand->getCurrentBeRo()->getHighestSet() > 0) {
// myAction = PLAYER_ACTION_FOLD; myAction = PLAYER_ACTION_FOLD;
// } }
} }
break; break;
case 2: { case 2: {
@@ -1772,7 +1817,7 @@ void LocalPlayer::flopEngine() {
case 5: { case 5: {
switch(currentHand->getMyID()) { switch(currentHand->getMyID()) {
case 1: { case 1: {
myAction = PLAYER_ACTION_CHECK; myAction = PLAYER_ACTION_FOLD;
// bet = 80; // bet = 80;
// if(currentHand->getCurrentBeRo()->getHighestSet() > 0) { // if(currentHand->getCurrentBeRo()->getHighestSet() > 0) {
// myAction = PLAYER_ACTION_FOLD; // myAction = PLAYER_ACTION_FOLD;
@@ -1793,6 +1838,31 @@ void LocalPlayer::flopEngine() {
} }
break;
case 6: {
switch(currentHand->getMyID()) {
case 1: {
myAction = PLAYER_ACTION_RAISE;
raise = 40;
if(currentHand->getCurrentBeRo()->getHighestSet() > 60) {
myAction = PLAYER_ACTION_CALL;
}
}
break;
case 2: {
// myAction = PLAYER_ACTION_RAISE;
// raise = 50;
// if(mySet >= 70) {
// myAction = PLAYER_ACTION_CALL;
// }
}
break;
default: {
}
}
}
break; break;
default: {} default: {}
} }
@@ -2388,11 +2458,12 @@ void LocalPlayer::turnEngine() {
case 3: { case 3: {
switch(currentHand->getMyID()) { switch(currentHand->getMyID()) {
case 1: { case 1: {
// myAction = PLAYER_ACTION_FOLD; myAction = PLAYER_ACTION_CALL;
// bet = 10; // bet = 10;
// if(currentHand->getCurrentBeRo()->getHighestSet() > 0) { if(currentHand->getCurrentBeRo()->getHighestSet() > 500) {
// myAction = PLAYER_ACTION_CALL; myAction = PLAYER_ACTION_RAISE;
// } raise = 10000;
}
} }
break; break;
case 2: { case 2: {
@@ -2460,6 +2531,32 @@ void LocalPlayer::turnEngine() {
} }
break; break;
case 6: {
switch(currentHand->getMyID()) {
case 1: {
myAction = PLAYER_ACTION_BET;
bet = 240;
if(currentHand->getCurrentBeRo()->getHighestSet() > 0) {
myAction = PLAYER_ACTION_RAISE;
raise = 10000;
}
}
break;
case 2: {
// myAction = PLAYER_ACTION_RAISE;
// raise = 50;
// if(mySet >= 70) {
// myAction = PLAYER_ACTION_CALL;
// }
}
break;
default: {
}
}
}
break;
default: {} default: {}
} }
@@ -2865,6 +2962,32 @@ void LocalPlayer::riverEngine() {
} }
break;
case 6: {
switch(currentHand->getMyID()) {
case 1: {
myAction = PLAYER_ACTION_BET;
bet = 240;
if(currentHand->getCurrentBeRo()->getHighestSet() > 0) {
myAction = PLAYER_ACTION_RAISE;
raise = 10000;
}
}
break;
case 2: {
// myAction = PLAYER_ACTION_RAISE;
// raise = 50;
// if(mySet >= 70) {
// myAction = PLAYER_ACTION_CALL;
// }
}
break;
default: {
}
}
}
break; break;
default: {} default: {}
} }
@@ -2919,10 +3042,14 @@ void LocalPlayer::evaluation(int bet, int raise) {
case 4: { case 4: {
// all in // all in
if(bet >= myCash) { if(bet >= myCash) {
mySet += myCash; // -> full bet rule
myCash = 0; if(myCash < 2*currentHand->getSmallBlind()) {
myAction = 6; currentHand->getCurrentBeRo()->setFullBetRule(true);
highestSet = mySet; }
mySet = myCash;
myCash = 0;
myAction = 6;
highestSet = mySet;
} }
// sonst // sonst
else { else {
@@ -2935,20 +3062,40 @@ void LocalPlayer::evaluation(int bet, int raise) {
// raise // raise
case 5: { case 5: {
// cout << "evaluation(raise) - highestSet = " << highestSet << " - raise: " << raise << endl; // cout << "evaluation(raise) - highestSet = " << highestSet << " - raise: " << raise << endl;
// all in // full bet rule -> only call possible
if(highestSet + raise >= myCash) { if(currentHand->getCurrentBeRo()->getFullBetRule()) {
mySet += myCash; // all in
myCash = 0; if(highestSet >= myCash + mySet) {
myAction = 6; mySet += myCash;
// cout << "evaluation(raise) - mySet: " << mySet << endl; myCash = 0;
if(mySet > highestSet) highestSet = mySet; myAction = 6;
} }
// sonst // sonst
else { else {
myCash = myCash + mySet - highestSet - raise; myCash = myCash - highestSet + mySet;
mySet = highestSet + raise; mySet = highestSet;
highestSet = mySet; myAction = 3;
} }
}
else {
// all in
if(highestSet + raise >= myCash + mySet) {
// -> full bet rule
if(highestSet + currentHand->getCurrentBeRo()->getMinimumRaise() > myCash + mySet) {
currentHand->getCurrentBeRo()->setFullBetRule(true);
}
mySet += myCash;
myCash = 0;
myAction = 6;
if(mySet > highestSet) highestSet = mySet;
}
// sonst
else {
myCash = myCash + mySet - highestSet - raise;
mySet = highestSet + raise;
highestSet = mySet;
}
}
} }
break; break;
// all in // all in
+14 -1
View File
@@ -20,7 +20,7 @@
#include "clientbero.h" #include "clientbero.h"
ClientBeRo::ClientBeRo(HandInterface* hi, int /*id*/, unsigned dP, int sB, GameState gS) ClientBeRo::ClientBeRo(HandInterface* hi, int /*id*/, unsigned dP, int sB, GameState gS)
: BeRoInterface(), myBeRoID(gS), myHand(hi), highestCardsValue(0), playersTurn(dP), highestSet(0), firstRound(true), smallBlindPosition(0), smallBlind(sB), minimumRaise(0) : BeRoInterface(), myBeRoID(gS), myHand(hi), highestCardsValue(0), playersTurn(dP), highestSet(0), firstRound(true), smallBlindPosition(0), smallBlind(sB), minimumRaise(0), fullBetRule(false)
{ {
} }
@@ -229,6 +229,19 @@ ClientBeRo::getMinimumRaise() const
return minimumRaise; return minimumRaise;
} }
void
ClientBeRo::setFullBetRule ( bool theValue )
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
fullBetRule = theValue;
}
bool
ClientBeRo::getFullBetRule() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return fullBetRule;
}
void void
ClientBeRo::skipFirstRunGui() ClientBeRo::skipFirstRunGui()
+3
View File
@@ -77,6 +77,8 @@ public:
void setMinimumRaise ( int theValue ); void setMinimumRaise ( int theValue );
int getMinimumRaise() const; int getMinimumRaise() const;
void setFullBetRule ( bool theValue );
bool getFullBetRule() const;
void skipFirstRunGui(); void skipFirstRunGui();
@@ -112,6 +114,7 @@ private:
int smallBlind; int smallBlind;
int minimumRaise; int minimumRaise;
bool fullBetRule;
int lastActionPlayer; int lastActionPlayer;
}; };
+1 -1
View File
@@ -41,7 +41,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
blindsList = myGameData.manualBlindsList; blindsList = myGameData.manualBlindsList;
if(DEBUG_MODE) { if(DEBUG_MODE) {
startSmallBlind = 320; startSmallBlind = 10;
currentSmallBlind = startSmallBlind; currentSmallBlind = startSmallBlind;
} }
+1 -1
View File
@@ -271,7 +271,7 @@ void startWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
startData.numberOfPlayers = gameData.maxNumberOfPlayers; startData.numberOfPlayers = gameData.maxNumberOfPlayers;
Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0); Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0);
if(DEBUG_MODE) { if(DEBUG_MODE) {
tmpDealerPos = 0; tmpDealerPos = 2;
} }
startData.startDealerPlayerId = static_cast<unsigned>(tmpDealerPos); startData.startDealerPlayerId = static_cast<unsigned>(tmpDealerPos);