From 8017d1c8cb936fd10336f0ec820d20587ebb927f Mon Sep 17 00:00:00 2001 From: floty Date: Tue, 19 Jan 2010 20:33:15 +0000 Subject: [PATCH] full bet rule (part 4) --- src/engine/local_engine/localhand.cpp | 20 +-- src/engine/local_engine/localplayer.cpp | 163 ++++++++++----------- src/gui/qt/startwindow/startwindowimpl.cpp | 2 +- 3 files changed, 91 insertions(+), 94 deletions(-) diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index 0b98705c..5f7f235c 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -104,11 +104,11 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI case 1: { - tempBoardArray[0] = 21; - tempBoardArray[1] = 8; + tempBoardArray[0] = 36; + tempBoardArray[1] = 21; tempBoardArray[2] = 50; - tempBoardArray[3] = 11; - tempBoardArray[4] = 16; + tempBoardArray[3] = 15; + tempBoardArray[4] = 12; myBoard->setMyCards(tempBoardArray); @@ -121,8 +121,8 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI // player0 it = seatsList->begin(); - tempPlayerArray[0] = 30; - tempPlayerArray[1] = 37; + tempPlayerArray[0] = 13; + tempPlayerArray[1] = 22; tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[1] = tempPlayerArray[1]; @@ -134,8 +134,8 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI // player1 it++; - tempPlayerArray[0] = 38; - tempPlayerArray[1] = 25; + tempPlayerArray[0] = 47; + tempPlayerArray[1] = 51; tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[1] = tempPlayerArray[1]; @@ -173,8 +173,8 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardI // player4 it++; - tempPlayerArray[0] = 45; - tempPlayerArray[1] = 8; + tempPlayerArray[0] = 48; + tempPlayerArray[1] = 7; tempPlayerAndBoardArray[0] = tempPlayerArray[0]; tempPlayerAndBoardArray[1] = tempPlayerArray[1]; diff --git a/src/engine/local_engine/localplayer.cpp b/src/engine/local_engine/localplayer.cpp index 2953a1bf..af88f48c 100755 --- a/src/engine/local_engine/localplayer.cpp +++ b/src/engine/local_engine/localplayer.cpp @@ -859,19 +859,19 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq switch(myUniqueID) { case 0: { - myCash=50; + myCash=19855; } break; case 1: { - myCash=1000; + myCash=20750; } break; case 2: { - myCash=1000; + myCash=0; } break; case 3: { myCash=0; } break; case 4: { - myCash=0; + myCash=9395; } break; case 5: { myCash=0; @@ -937,7 +937,7 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq // myDude4=0; } break; case 1: { - myDude4=-20; +// myDude4=-20; } break; case 2: { // myDude4=0; @@ -1037,6 +1037,8 @@ void LocalPlayer::action() { default: {} } +// cout << currentHand->getCurrentBeRo()->getMinimumRaise() << endl; + // cout << checkMyAction(myAction, mySet - myOldSet, myOldSet, myOldCash, oldHighestSet, oldMinimumRaise, currentHand->getSmallBlind()) << endl; @@ -1312,14 +1314,14 @@ void LocalPlayer::preflopEngine() { } // minimum raise setting and resetting - if(myAction == 5) { - - if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) { - raise = currentHand->getCurrentBeRo()->getMinimumRaise(); - } - currentHand->getCurrentBeRo()->setMinimumRaise(raise); - } - +// if(myAction == 5) { +// +// if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) { +// raise = currentHand->getCurrentBeRo()->getMinimumRaise(); +// } +// currentHand->getCurrentBeRo()->setMinimumRaise(raise); +// } +// // cout << myID << ": " << myOdds << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << "Bluff: " << sBluffStatus << endl; @@ -1332,8 +1334,8 @@ void LocalPlayer::preflopEngine() { switch(currentHand->getMyID()) { case 1: { - myAction = PLAYER_ACTION_RAISE; - raise = 20; + myAction = PLAYER_ACTION_CHECK; +// raise = 20; } break; case 2: { @@ -1700,18 +1702,6 @@ void LocalPlayer::flopEngine() { } - // minimum raise setting and resetting - if(myAction == 5) { - - if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) { - raise = currentHand->getCurrentBeRo()->getMinimumRaise(); - } - currentHand->getCurrentBeRo()->setMinimumRaise(raise); - - } - - if(myAction == 4) { currentHand->getCurrentBeRo()->setMinimumRaise(bet); } - if(DEBUG_MODE) { switch(myUniqueID) { @@ -1722,10 +1712,10 @@ void LocalPlayer::flopEngine() { switch(currentHand->getMyID()) { case 1: { myAction = PLAYER_ACTION_BET; - bet = 640; -// if(currentHand->getCurrentBeRo()->getHighestSet() > 0) { -// myAction = PLAYER_ACTION_CALL; -// } + bet = 20; + if(currentHand->getCurrentBeRo()->getHighestSet() > 0) { + myAction = PLAYER_ACTION_CALL; + } } break; case 2: { // myAction = PLAYER_ACTION_BET; @@ -1739,12 +1729,12 @@ void LocalPlayer::flopEngine() { switch(currentHand->getMyID()) { case 1: { - myAction = PLAYER_ACTION_CHECK; -// bet = 10; + myAction = PLAYER_ACTION_BET; + bet = 20; // raise = 20; -// if(mySet >= 40) { -// myAction = PLAYER_ACTION_CALL; -// } + if(mySet > 20) { + myAction = PLAYER_ACTION_CALL; + } // if(currentHand->getCurrentBeRo()->getHighestSet() > 0) { // myAction = PLAYER_ACTION_CALL; // } @@ -1792,11 +1782,11 @@ void LocalPlayer::flopEngine() { case 4: { switch(currentHand->getMyID()) { case 1: { - myAction = PLAYER_ACTION_BET; - bet = 40; - if(currentHand->getCurrentBeRo()->getHighestSet() > 0) { - myAction = PLAYER_ACTION_FOLD; - } + myAction = PLAYER_ACTION_RAISE; + raise = 140; +// if(currentHand->getCurrentBeRo()->getHighestSet() > 0) { +// myAction = PLAYER_ACTION_FOLD; +// } } break; case 2: { @@ -1870,6 +1860,18 @@ void LocalPlayer::flopEngine() { } + // minimum raise setting and resetting +// if(myAction == 5) { +// +// if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) { +// raise = currentHand->getCurrentBeRo()->getMinimumRaise(); +// } +// currentHand->getCurrentBeRo()->setMinimumRaise(raise); +// +// } +// +// if(myAction == 4) { currentHand->getCurrentBeRo()->setMinimumRaise(bet); } + evaluation(bet, raise); @@ -2388,18 +2390,6 @@ void LocalPlayer::turnEngine() { } - // minimum raise setting and resetting - if(myAction == 5) { - - if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) { - raise = currentHand->getCurrentBeRo()->getMinimumRaise(); - } - currentHand->getCurrentBeRo()->setMinimumRaise(raise); - - } - - if(myAction == 4) { currentHand->getCurrentBeRo()->setMinimumRaise(bet); } - if(DEBUG_MODE) { @@ -2412,11 +2402,11 @@ void LocalPlayer::turnEngine() { switch(currentHand->getMyID()) { case 1: { - myAction = PLAYER_ACTION_RAISE; - raise = 40; -// if(currentHand->getCurrentBeRo()->getHighestSet() > 100) { -// myAction = PLAYER_ACTION_FOLD; -// } + myAction = PLAYER_ACTION_BET; + bet = 20; + if(currentHand->getCurrentBeRo()->getHighestSet() > 20) { + myAction = PLAYER_ACTION_CALL; + } } break; case 2: { @@ -2484,8 +2474,8 @@ void LocalPlayer::turnEngine() { case 4: { switch(currentHand->getMyID()) { case 1: { - myAction = PLAYER_ACTION_CALL; -// bet = 10; + myAction = PLAYER_ACTION_RAISE; + raise = 120; // if(currentHand->getCurrentBeRo()->getHighestSet() > 0) { // myAction = PLAYER_ACTION_CALL; // } @@ -2563,6 +2553,18 @@ void LocalPlayer::turnEngine() { } + // minimum raise setting and resetting +// if(myAction == 5) { +// +// if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) { +// raise = currentHand->getCurrentBeRo()->getMinimumRaise(); +// } +// currentHand->getCurrentBeRo()->setMinimumRaise(raise); +// +// } +// +// if(myAction == 4) { currentHand->getCurrentBeRo()->setMinimumRaise(bet); } + evaluation(bet, raise); } @@ -2824,18 +2826,6 @@ void LocalPlayer::riverEngine() { } - // minimum raise setting and resetting - if(myAction == 5) { - - if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) { - raise = currentHand->getCurrentBeRo()->getMinimumRaise(); - } - currentHand->getCurrentBeRo()->setMinimumRaise(raise); - - } - - if(myAction == 4) { currentHand->getCurrentBeRo()->setMinimumRaise(bet); } - if(DEBUG_MODE) { switch(myUniqueID) { @@ -2845,10 +2835,11 @@ void LocalPlayer::riverEngine() { switch(currentHand->getMyID()) { case 1: { -// myAction = PLAYER_ACTION_CALL; -// if(currentHand->getCurrentBeRo()->getHighestSet() > 100) { -// myAction = PLAYER_ACTION_FOLD; -// } + myAction = PLAYER_ACTION_RAISE; + raise = 40; + if(currentHand->getCurrentBeRo()->getHighestSet() > 60) { + myAction = PLAYER_ACTION_CALL; + } } break; case 2: { // myAction = PLAYER_ACTION_BET; @@ -2916,10 +2907,10 @@ void LocalPlayer::riverEngine() { myAction = PLAYER_ACTION_RAISE; raise = 300; // bet = 120; -// if(currentHand->getCurrentBeRo()->getHighestSet() > 0) { -// myAction = PLAYER_ACTION_RAISE; -// raise = 10000; -// } + if(currentHand->getCurrentBeRo()->getHighestSet() > 360) { + myAction = PLAYER_ACTION_RAISE; + raise = 10000; + } } break; case 2: { @@ -3005,6 +2996,7 @@ void LocalPlayer::riverEngine() { void LocalPlayer::evaluation(int bet, int raise) { + int highestSet = 0; highestSet = currentHand->getCurrentBeRo()->getHighestSet(); @@ -3046,6 +3038,7 @@ void LocalPlayer::evaluation(int bet, int raise) { if(myCash < 2*currentHand->getSmallBlind()) { currentHand->getCurrentBeRo()->setFullBetRule(true); } + currentHand->getCurrentBeRo()->setMinimumRaise(myCash); mySet = myCash; myCash = 0; myAction = 6; @@ -3053,6 +3046,7 @@ void LocalPlayer::evaluation(int bet, int raise) { } // sonst else { + currentHand->getCurrentBeRo()->setMinimumRaise(bet); myCash = myCash - bet; mySet = bet; highestSet = mySet; @@ -3061,9 +3055,7 @@ void LocalPlayer::evaluation(int bet, int raise) { break; // raise case 5: { -// cout << "evaluation(raise) - highestSet = " << highestSet << " - raise: " << raise << endl; - // full bet rule -> only call possible - if(currentHand->getCurrentBeRo()->getFullBetRule()) { + if(currentHand->getCurrentBeRo()->getFullBetRule()) { // full bet rule -> only call possible // all in if(highestSet >= myCash + mySet) { mySet += myCash; @@ -3078,6 +3070,9 @@ void LocalPlayer::evaluation(int bet, int raise) { } } else { + if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) { + raise = currentHand->getCurrentBeRo()->getMinimumRaise(); + } // all in if(highestSet + raise >= myCash + mySet) { // -> full bet rule @@ -3085,12 +3080,14 @@ void LocalPlayer::evaluation(int bet, int raise) { currentHand->getCurrentBeRo()->setFullBetRule(true); } mySet += myCash; + currentHand->getCurrentBeRo()->setMinimumRaise(mySet-highestSet); myCash = 0; myAction = 6; if(mySet > highestSet) highestSet = mySet; } // sonst else { + currentHand->getCurrentBeRo()->setMinimumRaise(raise); myCash = myCash + mySet - highestSet - raise; mySet = highestSet + raise; highestSet = mySet; diff --git a/src/gui/qt/startwindow/startwindowimpl.cpp b/src/gui/qt/startwindow/startwindowimpl.cpp index 4c045f94..439bd596 100644 --- a/src/gui/qt/startwindow/startwindowimpl.cpp +++ b/src/gui/qt/startwindow/startwindowimpl.cpp @@ -271,7 +271,7 @@ void startWindowImpl::startNewLocalGame(newGameDialogImpl *v) { startData.numberOfPlayers = gameData.maxNumberOfPlayers; Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0); if(DEBUG_MODE) { - tmpDealerPos = 2; + tmpDealerPos = 4; } startData.startDealerPlayerId = static_cast(tmpDealerPos);