new distributePot function
This commit is contained in:
@@ -64,8 +64,8 @@ void LocalBeRoPostRiver::run() {
|
|||||||
// cout << "myAggressive: " << getMyHand()->getPlayerArray()[0]->getMyAggressive() << endl;
|
// cout << "myAggressive: " << getMyHand()->getPlayerArray()[0]->getMyAggressive() << endl;
|
||||||
|
|
||||||
// Pot-Verteilung
|
// Pot-Verteilung
|
||||||
// getMyHand()->getBoard()->distributePot();
|
getMyHand()->getBoard()->distributePot();
|
||||||
distributePot();
|
// distributePot();
|
||||||
|
|
||||||
//Pot auf 0 setzen
|
//Pot auf 0 setzen
|
||||||
getMyHand()->getBoard()->setPot(0);
|
getMyHand()->getBoard()->setPot(0);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ void LocalBeRoPreflop::run() {
|
|||||||
// Preflop ist wirklich dran
|
// Preflop ist wirklich dran
|
||||||
|
|
||||||
// naechsten Spieler ermitteln
|
// naechsten Spieler ermitteln
|
||||||
for(i=0; (MAX_NUMBER_OF_PLAYERS && (!(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyActiveStatus()) || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_FOLD || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_ALLIN)) || i==0; i++) {
|
for(i=0; (i<MAX_NUMBER_OF_PLAYERS && (!(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyActiveStatus()) || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_FOLD || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_ALLIN)) || i==0; i++) {
|
||||||
|
|
||||||
setPlayersTurn((getPlayersTurn()+1)%(MAX_NUMBER_OF_PLAYERS));
|
setPlayersTurn((getPlayersTurn()+1)%(MAX_NUMBER_OF_PLAYERS));
|
||||||
// falls BigBlind, dann PreflopFirstRound zuende
|
// falls BigBlind, dann PreflopFirstRound zuende
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ void LocalBoard::collectPot() {
|
|||||||
|
|
||||||
void LocalBoard::distributePot() {
|
void LocalBoard::distributePot() {
|
||||||
|
|
||||||
size_t i,j,k;
|
size_t i,j,k,l;
|
||||||
|
|
||||||
// filling player sets vector
|
// filling player sets vector
|
||||||
vector<int> playerSets;
|
vector<int> playerSets;
|
||||||
@@ -105,7 +105,7 @@ void LocalBoard::distributePot() {
|
|||||||
|
|
||||||
// level winners
|
// level winners
|
||||||
for(j=0; j<MAX_NUMBER_OF_PLAYERS; j++) {
|
for(j=0; j<MAX_NUMBER_OF_PLAYERS; j++) {
|
||||||
if(highestCardsValue == playerArray[j]->getMyCardsValueInt() && playerArray[j]->getMyActiveStatus() && playerArray[j]->getMyAction() != PLAYER_ACTION_FOLD) {
|
if(highestCardsValue == playerArray[j]->getMyCardsValueInt() && playerArray[j]->getMyActiveStatus() && playerArray[j]->getMyAction() != PLAYER_ACTION_FOLD && playerSets[j] >= potLevel[0]) {
|
||||||
potLevel.push_back(playerArray[j]->getMyID());
|
potLevel.push_back(playerArray[j]->getMyID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,17 +130,19 @@ void LocalBoard::distributePot() {
|
|||||||
|
|
||||||
for(j=0; j<winnerCount; j++) {
|
for(j=0; j<winnerCount; j++) {
|
||||||
|
|
||||||
do {
|
winnerHit = false;
|
||||||
|
|
||||||
|
for(k=0; k<MAX_NUMBER_OF_PLAYERS && !winnerHit; k++){
|
||||||
|
|
||||||
winnerPointer = (winnerPointer+1)%(MAX_NUMBER_OF_PLAYERS);
|
winnerPointer = (winnerPointer+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||||
|
|
||||||
winnerHit = false;
|
winnerHit = false;
|
||||||
|
|
||||||
for(k=2; k<potLevel.size(); k++) {
|
for(l=2; l<potLevel.size(); l++) {
|
||||||
if(winnerPointer == potLevel[k]) winnerHit = true;
|
if(winnerPointer == potLevel[l]) winnerHit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while(!winnerHit);
|
}
|
||||||
|
|
||||||
if(j<mod) {
|
if(j<mod) {
|
||||||
playerArray[winnerPointer]->setMyCash(playerArray[winnerPointer]->getMyCash() + (int)((potLevel[1])/winnerCount) + 1);
|
playerArray[winnerPointer]->setMyCash(playerArray[winnerPointer]->getMyCash() + (int)((potLevel[1])/winnerCount) + 1);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC)
|
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC)
|
||||||
: myFactory(f), myBeRo(0), myGui(g), myBoard(b), playerArray(p), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), activePlayersCounter(aP), lastPlayersTurn(0), allInCondition(0),
|
: myFactory(f), myGui(g), myBoard(b), playerArray(p), myBeRo(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), activePlayersCounter(aP), lastPlayersTurn(0), allInCondition(0),
|
||||||
cardsShown(false), bettingRoundsPlayed(0)
|
cardsShown(false), bettingRoundsPlayed(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -98,69 +98,75 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
|||||||
}
|
}
|
||||||
delete[] cardsArray;
|
delete[] cardsArray;
|
||||||
|
|
||||||
// // // !!!!!!!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //
|
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //
|
||||||
|
|
||||||
// // int *temp5Array;
|
int temp5Array[5];
|
||||||
// //
|
|
||||||
// // tempBoardArray[0] = 25;
|
tempBoardArray[0] = 8;
|
||||||
// // tempBoardArray[1] = 50;
|
tempBoardArray[1] = 9;
|
||||||
// // tempBoardArray[2] = 24;
|
tempBoardArray[2] = 10;
|
||||||
// // tempBoardArray[3] = 22;
|
tempBoardArray[3] = 11;
|
||||||
// // tempBoardArray[4] = 51;
|
tempBoardArray[4] = 13;
|
||||||
// //
|
|
||||||
// // myBoard->setMyCards(tempBoardArray);
|
myBoard->setMyCards(tempBoardArray);
|
||||||
// //
|
|
||||||
// // tempPlayerAndBoardArray[2] = tempBoardArray[0];
|
tempPlayerAndBoardArray[2] = tempBoardArray[0];
|
||||||
// // tempPlayerAndBoardArray[3] = tempBoardArray[1];
|
tempPlayerAndBoardArray[3] = tempBoardArray[1];
|
||||||
// // tempPlayerAndBoardArray[4] = tempBoardArray[2];
|
tempPlayerAndBoardArray[4] = tempBoardArray[2];
|
||||||
// // tempPlayerAndBoardArray[5] = tempBoardArray[3];
|
tempPlayerAndBoardArray[5] = tempBoardArray[3];
|
||||||
// // tempPlayerAndBoardArray[6] = tempBoardArray[4];
|
tempPlayerAndBoardArray[6] = tempBoardArray[4];
|
||||||
// //
|
|
||||||
// // tempPlayerArray[0] = 12;
|
tempPlayerArray[0] = 13;
|
||||||
// // tempPlayerArray[1] = 27;
|
tempPlayerArray[1] = 25;
|
||||||
// // tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
||||||
// // tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
||||||
// //
|
|
||||||
// // playerArray[0]->setMyCards(tempPlayerArray);
|
playerArray[0]->setMyCards(tempPlayerArray);
|
||||||
// // playerArray[0]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,playerArray[0]->getMyBestHandPosition()));
|
playerArray[0]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
||||||
// //
|
|
||||||
// // temp5Array = playerArray[0]->getMyBestHandPosition();
|
playerArray[0]->setMyBestHandPosition(temp5Array);
|
||||||
// //
|
|
||||||
// // // for(i=0; i<5; i++) {
|
// for(i=0; i<5; i++) {
|
||||||
// // // cout << temp5Array[i] << " ";
|
// cout << temp5Array[i] << " ";
|
||||||
// // // }
|
// }
|
||||||
// // // cout << endl;
|
// cout << endl;
|
||||||
// //
|
|
||||||
// // tempPlayerArray[0] = 23;
|
tempPlayerArray[0] = 23;
|
||||||
// // tempPlayerArray[1] = 2;
|
tempPlayerArray[1] = 15;
|
||||||
// // tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
||||||
// // tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
||||||
// //
|
|
||||||
// // playerArray[1]->setMyCards(tempPlayerArray);
|
playerArray[1]->setMyCards(tempPlayerArray);
|
||||||
// // playerArray[1]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,playerArray[1]->getMyBestHandPosition()));
|
playerArray[1]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
||||||
// //
|
|
||||||
// // tempPlayerArray[0] = 20;
|
playerArray[1]->setMyBestHandPosition(temp5Array);
|
||||||
// // tempPlayerArray[1] = 38;
|
|
||||||
// // tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
tempPlayerArray[0] = 20;
|
||||||
// // tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
tempPlayerArray[1] = 38;
|
||||||
// //
|
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
||||||
// // playerArray[2]->setMyCards(tempPlayerArray);
|
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
||||||
// // playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,playerArray[2]->getMyBestHandPosition()));
|
|
||||||
// //
|
playerArray[2]->setMyCards(tempPlayerArray);
|
||||||
// // tempPlayerArray[0] = 19;
|
playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
||||||
// // tempPlayerArray[1] = 10;
|
|
||||||
// // tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
playerArray[2]->setMyBestHandPosition(temp5Array);
|
||||||
// // tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
|
||||||
// //
|
tempPlayerArray[0] = 19;
|
||||||
// // playerArray[3]->setMyCards(tempPlayerArray);
|
tempPlayerArray[1] = 21;
|
||||||
// // playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,playerArray[3]->getMyBestHandPosition()));
|
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
||||||
// //
|
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
||||||
// // for(i=0; i<4; i++) {
|
|
||||||
// // cout << i << ": " << playerArray[i]->getMyCardsValueInt() << endl;
|
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;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
// // // ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
||||||
// Dealer, SB, BB bestimmen
|
// Dealer, SB, BB bestimmen
|
||||||
assignButtons();
|
assignButtons();
|
||||||
@@ -351,7 +357,6 @@ void LocalHand::switchRounds() {
|
|||||||
// /*/*/*/*cout <<*/*/*/*/ "NextPlayerSpeed1 stop" << endl;
|
// /*/*/*/*cout <<*/*/*/*/ "NextPlayerSpeed1 stop" << endl;
|
||||||
//
|
//
|
||||||
|
|
||||||
int currentRound = actualRound;
|
|
||||||
|
|
||||||
// cout << "NextPlayerSpeed2 start" << endl;
|
// cout << "NextPlayerSpeed2 start" << endl;
|
||||||
switch(actualRound) {
|
switch(actualRound) {
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
|
|||||||
// if(myID==1) {
|
// if(myID==1) {
|
||||||
// myCash=6130;
|
// myCash=6130;
|
||||||
// }
|
// }
|
||||||
// if(myID==2) {
|
if(myID==2) {
|
||||||
// myCash=2850;
|
myCash=37;
|
||||||
// }
|
}
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
|
|
||||||
// myBestHandPosition mit -1 initialisieren
|
// myBestHandPosition mit -1 initialisieren
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
||||||
: QMainWindow(parent), myConfig(c), gameSpeed(0), myActionIsBet(0), myActionIsRaise(0), debugMode(0), breakAfterActualHand(FALSE)
|
: QMainWindow(parent), myConfig(c), gameSpeed(0), myActionIsBet(0), myActionIsRaise(0), debugMode(1), breakAfterActualHand(FALSE)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user