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
+1 -1
View File
@@ -26,7 +26,7 @@
using namespace std;
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();
lastPlayersTurnIt = myHand->getRunningPlayerList()->begin();
+4
View File
@@ -39,6 +39,9 @@ public:
void setMinimumRaise ( int theValue ) { minimumRaise = theValue; }
int getMinimumRaise() const { return minimumRaise; }
void setFullBetRule ( bool theValue ) { fullBetRule = theValue; }
bool getFullBetRule() const { return fullBetRule; }
void skipFirstRunGui() { firstRunGui = false; }
void nextPlayer();
@@ -118,6 +121,7 @@ private:
int smallBlind;
int highestSet;
int minimumRaise;
bool fullBetRule;
bool firstRun;
bool firstRunGui; // HACK
+42 -29
View File
@@ -104,11 +104,11 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
case 1: {
tempBoardArray[0] = 48;
tempBoardArray[1] = 10;
tempBoardArray[2] = 11;
tempBoardArray[3] = 1;
tempBoardArray[4] = 26;
tempBoardArray[0] = 21;
tempBoardArray[1] = 8;
tempBoardArray[2] = 50;
tempBoardArray[3] = 11;
tempBoardArray[4] = 16;
myBoard->setMyCards(tempBoardArray);
@@ -121,8 +121,8 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player0
it = seatsList->begin();
tempPlayerArray[0] = 24;
tempPlayerArray[1] = 45;
tempPlayerArray[0] = 30;
tempPlayerArray[1] = 37;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -134,8 +134,8 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player1
it++;
tempPlayerArray[0] = 38;
tempPlayerArray[1] = 27;
tempPlayerArray[0] = 38;
tempPlayerArray[1] = 25;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -160,15 +160,15 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> 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);
tempPlayerArray[0] = 36;
tempPlayerArray[1] = 47;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
(*it)->setMyCards(tempPlayerArray);
(*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
(*it)->setMyBestHandPosition(temp5Array);
// player4
it++;
@@ -186,21 +186,21 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// 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);
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);
// player6
it++;
tempPlayerArray[0] = 31;
tempPlayerArray[1] = 19;
tempPlayerArray[0] = 24;
tempPlayerArray[1] = 6;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -209,6 +209,19 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
(*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;
case 2: {
+190 -43
View File
@@ -859,25 +859,25 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
switch(myUniqueID) {
case 0: {
myCash=23110;
myCash=2765;
} break;
case 1: {
myCash=1320;
myCash=50;
} break;
case 2: {
myCash=0;
myCash=100;
} break;
case 3: {
myCash=0;
myCash=0;
} break;
case 4: {
myCash=0;
myCash=0;
} break;
case 5: {
myCash=0;
myCash=0;
} break;
case 6: {
myCash=0;
myCash=0;
} break;
case 7: {
myCash=0;
@@ -928,6 +928,51 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
}
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;
myCardsValue = new CardsValue;
@@ -1287,8 +1332,8 @@ void LocalPlayer::preflopEngine() {
switch(currentHand->getMyID()) {
case 1: {
myAction = PLAYER_ACTION_CHECK;
// raise = 3000;
myAction = PLAYER_ACTION_RAISE;
raise = 20;
}
break;
case 2: {
@@ -1307,8 +1352,8 @@ void LocalPlayer::preflopEngine() {
switch(currentHand->getMyID()) {
case 1: {
myAction = PLAYER_ACTION_CALL;
// raise = 20;
myAction = PLAYER_ACTION_RAISE;
raise = 20;
// if(mySet >= 40) {
// myAction = PLAYER_ACTION_CALL;
// }
@@ -1331,7 +1376,7 @@ void LocalPlayer::preflopEngine() {
case 3: {
switch(currentHand->getMyID()) {
case 1: {
myAction = PLAYER_ACTION_FOLD;
myAction = PLAYER_ACTION_CALL;
// raise = 20;
// if(mySet >= 40) {
// myAction = PLAYER_ACTION_CALL;
@@ -1376,7 +1421,7 @@ void LocalPlayer::preflopEngine() {
break;
case 5: {
// if(mySet == 0) {
myAction = PLAYER_ACTION_CALL;
myAction = PLAYER_ACTION_CHECK;
// }
}
break;
@@ -1722,8 +1767,8 @@ void LocalPlayer::flopEngine() {
case 3: {
switch(currentHand->getMyID()) {
case 1: {
// myAction = PLAYER_ACTION_BET;
// bet = 80;
myAction = PLAYER_ACTION_RAISE;
raise = 400;
// if(currentHand->getCurrentBeRo()->getHighestSet() > 0) {
// myAction = PLAYER_ACTION_CALL;
// }
@@ -1747,11 +1792,11 @@ void LocalPlayer::flopEngine() {
case 4: {
switch(currentHand->getMyID()) {
case 1: {
myAction = PLAYER_ACTION_CHECK;
// bet = 80;
// if(currentHand->getCurrentBeRo()->getHighestSet() > 0) {
// myAction = PLAYER_ACTION_FOLD;
// }
myAction = PLAYER_ACTION_BET;
bet = 40;
if(currentHand->getCurrentBeRo()->getHighestSet() > 0) {
myAction = PLAYER_ACTION_FOLD;
}
}
break;
case 2: {
@@ -1772,7 +1817,7 @@ void LocalPlayer::flopEngine() {
case 5: {
switch(currentHand->getMyID()) {
case 1: {
myAction = PLAYER_ACTION_CHECK;
myAction = PLAYER_ACTION_FOLD;
// bet = 80;
// if(currentHand->getCurrentBeRo()->getHighestSet() > 0) {
// 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;
default: {}
}
@@ -2388,11 +2458,12 @@ void LocalPlayer::turnEngine() {
case 3: {
switch(currentHand->getMyID()) {
case 1: {
// myAction = PLAYER_ACTION_FOLD;
myAction = PLAYER_ACTION_CALL;
// bet = 10;
// if(currentHand->getCurrentBeRo()->getHighestSet() > 0) {
// myAction = PLAYER_ACTION_CALL;
// }
if(currentHand->getCurrentBeRo()->getHighestSet() > 500) {
myAction = PLAYER_ACTION_RAISE;
raise = 10000;
}
}
break;
case 2: {
@@ -2460,6 +2531,32 @@ void LocalPlayer::turnEngine() {
}
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: {}
}
@@ -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;
default: {}
}
@@ -2919,10 +3042,14 @@ void LocalPlayer::evaluation(int bet, int raise) {
case 4: {
// all in
if(bet >= myCash) {
mySet += myCash;
myCash = 0;
myAction = 6;
highestSet = mySet;
// -> full bet rule
if(myCash < 2*currentHand->getSmallBlind()) {
currentHand->getCurrentBeRo()->setFullBetRule(true);
}
mySet = myCash;
myCash = 0;
myAction = 6;
highestSet = mySet;
}
// sonst
else {
@@ -2935,20 +3062,40 @@ void LocalPlayer::evaluation(int bet, int raise) {
// raise
case 5: {
// cout << "evaluation(raise) - highestSet = " << highestSet << " - raise: " << raise << endl;
// all in
if(highestSet + raise >= myCash) {
mySet += myCash;
myCash = 0;
myAction = 6;
// cout << "evaluation(raise) - mySet: " << mySet << endl;
if(mySet > highestSet) highestSet = mySet;
}
// sonst
else {
myCash = myCash + mySet - highestSet - raise;
mySet = highestSet + raise;
highestSet = mySet;
}
// full bet rule -> only call possible
if(currentHand->getCurrentBeRo()->getFullBetRule()) {
// all in
if(highestSet >= myCash + mySet) {
mySet += myCash;
myCash = 0;
myAction = 6;
}
// sonst
else {
myCash = myCash - highestSet + mySet;
mySet = highestSet;
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;
// all in