refactoring Bugfix

This commit is contained in:
doitux
2007-08-11 14:36:20 +00:00
parent b18152c0b8
commit 851cce3e45
12 changed files with 182 additions and 104 deletions
+3
View File
@@ -34,6 +34,9 @@ public:
virtual void setHighestCardsValue(int theValue) =0;
virtual int getHighestCardsValue() const =0;
virtual void setLastActionPlayer( int theValue ) =0;
virtual int getLastActionPlayer() const =0;
virtual void resetFirstRun() =0;
virtual void nextPlayer() =0;
+5
View File
@@ -57,6 +57,9 @@ protected:
void setSmallBlind(int theValue) { smallBlind = theValue; }
int getSmallBlind() const { return smallBlind; }
void setLastActionPlayer ( int theValue ) { lastActionPlayer = theValue; }
int getLastActionPlayer() const { return lastActionPlayer; }
private:
@@ -79,6 +82,8 @@ private:
bool logBoardCardsDone;
int lastActionPlayer;
};
@@ -25,7 +25,7 @@
using namespace std;
LocalBeRoPostRiver::LocalBeRoPostRiver(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB, GAME_STATE_POST_RIVER)
LocalBeRoPostRiver::LocalBeRoPostRiver(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB, GAME_STATE_POST_RIVER), highestCardsValue(0)
{
}
+1 -1
View File
@@ -36,7 +36,7 @@ public:
void run();
void distributePot();
private:
int highestCardsValue;
+70 -64
View File
@@ -100,72 +100,78 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //
// // int temp5Array[5];
// //
// // tempBoardArray[0] = 8;
// // tempBoardArray[1] = 9;
// // tempBoardArray[2] = 10;
// // tempBoardArray[3] = 11;
// // 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];
// //
// // tempPlayerArray[0] = 13;
// // tempPlayerArray[1] = 25;
// // tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// // tempPlayerAndBoardArray[1] = tempPlayerArray[1];
// //
// // playerArray[0]->setMyCards(tempPlayerArray);
// // playerArray[0]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
// //
// // playerArray[0]->setMyBestHandPosition(temp5Array);
// //
// // // for(i=0; i<5; i++) {
// // // cout << temp5Array[i] << " ";
// // // }
// // // cout << endl;
// //
// // tempPlayerArray[0] = 31;
// // tempPlayerArray[1] = 18;
// // tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// // tempPlayerAndBoardArray[1] = tempPlayerArray[1];
// //
// // playerArray[1]->setMyCards(tempPlayerArray);
// // playerArray[1]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
// //
// // playerArray[1]->setMyBestHandPosition(temp5Array);
// //
// // tempPlayerArray[0] = 20;
// // tempPlayerArray[1] = 38;
// // tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// // tempPlayerAndBoardArray[1] = tempPlayerArray[1];
// //
// // playerArray[2]->setMyCards(tempPlayerArray);
// // playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
// //
// // playerArray[2]->setMyBestHandPosition(temp5Array);
// //
// // tempPlayerArray[0] = 19;
// // tempPlayerArray[1] = 51;
// // tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// // tempPlayerAndBoardArray[1] = tempPlayerArray[1];
// //
// // playerArray[3]->setMyCards(tempPlayerArray);
// // playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
// //
// // playerArray[3]->setMyBestHandPosition(temp5Array);
// //
// // // for(i=0; i<4; i++) {
// // // cout << i << ": " << playerArray[i]->getMyCardsValueInt() << endl;
// // // }
if(DEBUG_MODE) {
int temp5Array[5];
tempBoardArray[0] = 28;
tempBoardArray[1] = 45;
tempBoardArray[2] = 33;
tempBoardArray[3] = 4;
tempBoardArray[4] = 49;
myBoard->setMyCards(tempBoardArray);
tempPlayerAndBoardArray[2] = tempBoardArray[0];
tempPlayerAndBoardArray[3] = tempBoardArray[1];
tempPlayerAndBoardArray[4] = tempBoardArray[2];
tempPlayerAndBoardArray[5] = tempBoardArray[3];
tempPlayerAndBoardArray[6] = tempBoardArray[4];
tempPlayerArray[0] = 47;
tempPlayerArray[1] = 12;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
playerArray[0]->setMyCards(tempPlayerArray);
playerArray[0]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
playerArray[0]->setMyBestHandPosition(temp5Array);
// for(i=0; i<5; i++) {
// cout << temp5Array[i] << " ";
// }
// cout << endl;
tempPlayerArray[0] = 31;
tempPlayerArray[1] = 18;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
playerArray[1]->setMyCards(tempPlayerArray);
playerArray[1]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
playerArray[1]->setMyBestHandPosition(temp5Array);
tempPlayerArray[0] = 24;
tempPlayerArray[1] = 48;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
playerArray[2]->setMyCards(tempPlayerArray);
playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
playerArray[2]->setMyBestHandPosition(temp5Array);
tempPlayerArray[0] = 19;
tempPlayerArray[1] = 51;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
playerArray[3]->setMyCards(tempPlayerArray);
playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
playerArray[3]->setMyBestHandPosition(temp5Array);
// for(i=0; i<4; i++) {
// cout << i << ": " << playerArray[i]->getMyCardsValueInt() << endl;
// }
dealerPosition = 0;
}
// ----------------------------------------
// Dealer, SB, BB bestimmen
+41 -12
View File
@@ -31,18 +31,25 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
: PlayerInterface(), myConfig(c), actualHand(0), actualBoard(b), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(0), myButton(mB), myActiveStatus(aS), myTurn(0), myRoundStartCash(0), sBluff(0), sBluffStatus(0)
{
// for statistic development
// if(myID==0) {
// myActiveStatus=0;
// myCash=20;
// }
//
// if(myID==1) {
// myCash=6130;
// }
// if(myID==2) {
// myCash=37;
// }
// !!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!!
if(DEBUG_MODE) {
if(myID==0) {
// myActiveStatus=0;
myCash=570;
}
if(myID==1) {
myCash=2730;
}
if(myID==2) {
myCash=5970;
}
if(myID==3) {
myCash=2730;
}
}
////////////////////////////
// myBestHandPosition mit -1 initialisieren
@@ -332,6 +339,23 @@ void LocalPlayer::preflopEngine() {
// cout << myID << ": " << myOdds << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << "Bluff: " << sBluffStatus << endl;
if(DEBUG_MODE) {
switch(myID) {
case 0: {}
break;
case 1: { myAction = PLAYER_ACTION_FOLD; }
break;
case 2: { myAction = PLAYER_ACTION_CALL; }
break;
case 3: { myAction = PLAYER_ACTION_FOLD; }
break;
default: {}
}
}
evaluation(bet, raise);
}
@@ -1215,6 +1239,10 @@ void LocalPlayer::riverEngine() {
}
}
}
// lastPlayerAction für Karten umblättern reihenfolge setzrn
actualHand->getCurrentBeRo()->setLastActionPlayer(myID);
}
// auf sBluffStatus testen --> raise statt call und bet statt check
@@ -1292,6 +1320,7 @@ void LocalPlayer::evaluation(int bet, int raise) {
highestSet = actualHand->getCurrentBeRo()->getHighestSet();
// cout << "myAction(evaluation): " << myAction << endl;
switch(myAction) {
// none
+12
View File
@@ -41,6 +41,18 @@ ClientBeRo::setHighestCardsValue(int theValue)
highestCardsValue = theValue;
}
void
ClientBeRo::setLastActionPlayer ( int theValue )
{
lastActionPlayer = theValue;
}
int
ClientBeRo::getLastActionPlayer() const
{
return lastActionPlayer;
}
void
ClientBeRo::setPlayersTurn(int theValue)
{
+5
View File
@@ -30,6 +30,9 @@ public:
int getHighestCardsValue() const;
void setHighestCardsValue(int theValue);
void setLastActionPlayer ( int theValue );
int getLastActionPlayer() const;
void setPlayersTurn(int theValue);
int getPlayersTurn() const;
@@ -64,6 +67,8 @@ private:
bool firstRound;
int smallBlindPosition;
int smallBlind;
int lastActionPlayer;
};
#endif