more polymorphie steps for BeRo
This commit is contained in:
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
virtual ~BeRoFactoryInterface();
|
||||
|
||||
virtual BeRoInterface* switchRounds() = 0;
|
||||
virtual BeRoInterface* switchRounds(int) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ class BeRoInterface{
|
||||
public:
|
||||
|
||||
virtual ~BeRoInterface();
|
||||
|
||||
virtual int getMyBeRoID() const =0;
|
||||
|
||||
virtual void setPlayersTurn(int) =0;
|
||||
virtual int getPlayersTurn() const =0;
|
||||
@@ -26,10 +28,12 @@ public:
|
||||
virtual void setHighestSet(int) =0;
|
||||
virtual int getHighestSet() const =0;
|
||||
|
||||
virtual void setPreflopFirstRound(bool) =0;
|
||||
virtual bool setPreflopFirstRound() const =0;
|
||||
|
||||
virtual void preflopRun() =0;
|
||||
virtual void flopRun() =0;
|
||||
virtual void turnRun() =0;
|
||||
virtual void riverRun() =0;
|
||||
virtual void postRiverRun() =0;
|
||||
|
||||
virtual void nextPlayer2() =0;
|
||||
|
||||
};
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
virtual TurnInterface* getTurn() const =0;
|
||||
virtual RiverInterface* getRiver() const =0;
|
||||
virtual GuiInterface* getGuiInterface() const =0;
|
||||
virtual BeRoInterface* getCurrentBeRo() const =0;
|
||||
|
||||
virtual void setMyID(int theValue) =0;
|
||||
virtual int getMyID() const =0;
|
||||
|
||||
@@ -23,6 +23,12 @@ public:
|
||||
|
||||
~LocalBeRo();
|
||||
|
||||
int getMyBeRoID() const { return myBeRoID; }
|
||||
|
||||
protected:
|
||||
|
||||
int myBeRoID;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
//
|
||||
#include "localberofactory.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
LocalBeRoFactory::LocalBeRoFactory (HandInterface* hi, int id, int aP, int dP, int sB)
|
||||
: BeRoFactoryInterface() , myHand(hi), myID(id), actualQuantityPlayers(aP), dealerPosition(dP), smallBlind(sB)
|
||||
{}
|
||||
@@ -19,12 +21,68 @@ LocalBeRoFactory::LocalBeRoFactory (HandInterface* hi, int id, int aP, int dP, i
|
||||
LocalBeRoFactory::~LocalBeRoFactory()
|
||||
{}
|
||||
|
||||
BeRoInterface* LocalBeRoFactory::switchRounds()
|
||||
BeRoInterface* LocalBeRoFactory::switchRounds(int currentRound)
|
||||
{
|
||||
|
||||
BeRoInterface* myBeRo = NULL;
|
||||
|
||||
myBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
|
||||
switch(currentRound) {
|
||||
case GAME_STATE_PREFLOP: {
|
||||
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
|
||||
|
||||
delete myBeRo;
|
||||
myBeRo = NULL;
|
||||
|
||||
myBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GAME_STATE_FLOP: {
|
||||
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
|
||||
|
||||
delete myBeRo;
|
||||
myBeRo = NULL;
|
||||
|
||||
myBeRo = new LocalBeRoFlop( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GAME_STATE_TURN: {
|
||||
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
|
||||
|
||||
delete myBeRo;
|
||||
myBeRo = NULL;
|
||||
|
||||
myBeRo = new LocalBeRoTurn( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GAME_STATE_RIVER: {
|
||||
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
|
||||
|
||||
delete myBeRo;
|
||||
myBeRo = NULL;
|
||||
|
||||
myBeRo = new LocalBeRoRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GAME_STATE_POST_RIVER: {
|
||||
if(currentRound != myHand->getCurrentBeRo()->getMyBeRoID()) {
|
||||
|
||||
delete myBeRo;
|
||||
myBeRo = NULL;
|
||||
|
||||
myBeRo = new LocalBeRoPostRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: { cout << "BeRoFactory-ERROR" << endl; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return myBeRo;
|
||||
}
|
||||
|
||||
@@ -12,10 +12,16 @@
|
||||
#ifndef LOCALBEROFACTORY_H
|
||||
#define LOCALBEROFACTORY_H
|
||||
|
||||
#include <istream>
|
||||
|
||||
#include <berofactoryinterface.h>
|
||||
#include <berointerface.h>
|
||||
#include <handinterface.h>
|
||||
#include <localberopreflop.h>
|
||||
#include <localberoflop.h>
|
||||
#include <localberoturn.h>
|
||||
#include <localberoriver.h>
|
||||
#include <localberopostriver.h>
|
||||
|
||||
/**
|
||||
@author FThauer FHammer <webmaster@pokerth.net>
|
||||
@@ -27,7 +33,7 @@ public:
|
||||
|
||||
~LocalBeRoFactory();
|
||||
|
||||
BeRoInterface* switchRounds();
|
||||
BeRoInterface* switchRounds(int);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@web.de *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "localberoflop.h"
|
||||
|
||||
#include <game_defs.h>
|
||||
#include <handinterface.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
LocalBeRoFlop::LocalBeRoFlop(HandInterface* bR, int id, int qP, int dP, int sB) : LocalBeRo(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstFlopRun(1), firstFlopRound(1), firstHeadsUpFlopRound(1), playersTurn(dP), logBoardCardsDone(0)
|
||||
|
||||
{
|
||||
|
||||
myBeRoID = GAME_STATE_FLOP;
|
||||
|
||||
int i;
|
||||
|
||||
//SmallBlind-Position ermitteln
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if (myHand->getPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i;
|
||||
}
|
||||
|
||||
cout << "LocalBeroFlop erstellt - " << myBeRoID << endl;
|
||||
}
|
||||
|
||||
|
||||
LocalBeRoFlop::~LocalBeRoFlop()
|
||||
{
|
||||
}
|
||||
|
||||
void LocalBeRoFlop::flopRun() {
|
||||
|
||||
cout << "LocalBeroFlopRun!!!" << endl;
|
||||
|
||||
int i;
|
||||
|
||||
if (firstFlopRun) {
|
||||
myHand->getGuiInterface()->dealFlopCards();
|
||||
firstFlopRun = 0;
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
//log the turned cards
|
||||
if(!logBoardCardsDone) {
|
||||
int tempBoardCardsArray[5];
|
||||
|
||||
myHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
myHand->getGuiInterface()->logDealBoardCardsMsg(1, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2]);
|
||||
logBoardCardsDone = 1;
|
||||
}
|
||||
|
||||
bool allHighestSet = 1;
|
||||
|
||||
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
|
||||
if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
|
||||
}
|
||||
}
|
||||
|
||||
// cout << "firstflopround " << firstFlopRound << endl;
|
||||
|
||||
// prfen, ob Flop wirklich dran ist
|
||||
if(!firstFlopRound && allHighestSet) {
|
||||
|
||||
// Flop nicht dran, weil alle Sets gleich sind
|
||||
//also gehe in Turn
|
||||
myHand->setActualRound(2);
|
||||
|
||||
//Action loeschen und ActionButtons refresh
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0);
|
||||
}
|
||||
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
|
||||
myHand->getBoard()->collectSets();
|
||||
myHand->getBoard()->collectPot();
|
||||
myHand->getGuiInterface()->refreshPot();
|
||||
|
||||
myHand->getGuiInterface()->refreshSet();
|
||||
myHand->getGuiInterface()->refreshCash();
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { myHand->getGuiInterface()->refreshAction(i,0); }
|
||||
|
||||
myHand->switchRounds();
|
||||
}
|
||||
else {
|
||||
// Flop ist wirklich dran
|
||||
|
||||
// Anzahl der effektiv gespielten Runden (des human player) erhöhen
|
||||
if(myHand->getPlayerArray()[0]->getMyActiveStatus() && myHand->getPlayerArray()[0]->getMyAction() != 1) {
|
||||
myHand->setBettingRoundsPlayed(1);
|
||||
}
|
||||
|
||||
if( !(myHand->getActualQuantityPlayers() < 3 && firstHeadsUpFlopRound == 1) ) {
|
||||
// not first round in heads up (for headsup dealer is smallblind so it is dealers turn)
|
||||
|
||||
// naechsten Spieler ermitteln
|
||||
do { playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||
} while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6);
|
||||
}
|
||||
else { firstHeadsUpFlopRound = 0; }
|
||||
|
||||
//Spieler-Position vor SmallBlind-Position ermitteln
|
||||
int activePlayerBeforeSmallBlind = smallBlindPosition;
|
||||
do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS);
|
||||
} while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6);
|
||||
|
||||
myHand->getPlayerArray()[playersTurn]->setMyTurn(1);
|
||||
//highlight active players groupbox and clear action
|
||||
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
||||
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
||||
|
||||
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
|
||||
// cout << "playersTurn " << playersTurn << endl;
|
||||
|
||||
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
||||
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstFlopRound = 0; }
|
||||
|
||||
if(playersTurn == 0) {
|
||||
// Wir sind dran
|
||||
// cout << "actualRound " << myHand->getActualRound() << endl;
|
||||
// cout << "highestSet vor meInAction " << highestSet << endl;
|
||||
myHand->getGuiInterface()->meInAction();
|
||||
}
|
||||
else {
|
||||
//Gegner sind dran
|
||||
// cout << "NextPlayerSpeed3 start" << endl;
|
||||
myHand->getGuiInterface()->flopAnimation2();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LocalBeRoFlop::nextPlayer2() {
|
||||
|
||||
// cout << "NextPlayerSpeed3 stop" << endl;
|
||||
myHand->getPlayerArray()[playersTurn]->action();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@web.de *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef LOCALBEROFLOP_H
|
||||
#define LOCALBEROFLOP_H
|
||||
|
||||
#include <iostream>
|
||||
#include <localbero.h>
|
||||
|
||||
class HandInterface;
|
||||
|
||||
class LocalBeRoFlop : public LocalBeRo{
|
||||
|
||||
public:
|
||||
LocalBeRoFlop(HandInterface*, int, int, int, int);
|
||||
~LocalBeRoFlop();
|
||||
|
||||
|
||||
void setPlayersTurn(int theValue) { playersTurn = theValue; }
|
||||
int getPlayersTurn() const { return playersTurn; }
|
||||
|
||||
void setHighestSet(int theValue) { highestSet = theValue; }
|
||||
int getHighestSet() const { return highestSet;}
|
||||
|
||||
void setFirstFlopRound(bool theValue) { firstFlopRound = theValue;}
|
||||
bool getFirstFlopRound() const { return firstFlopRound;}
|
||||
|
||||
void setSmallBlindPosition(int theValue) { smallBlindPosition = theValue;}
|
||||
int getSmallBlindPosition() const { return smallBlindPosition; }
|
||||
|
||||
void setSmallBlind(int theValue) { smallBlind = theValue; }
|
||||
int getSmallBlind() const { return smallBlind; }
|
||||
|
||||
void resetFirstRun() { firstFlopRun = false; }
|
||||
|
||||
void flopRun();
|
||||
void nextPlayer2();
|
||||
|
||||
//only until bero refactory is over
|
||||
void preflopRun() {}
|
||||
void turnRun() {}
|
||||
void riverRun() {}
|
||||
void postRiverRun() {}
|
||||
|
||||
private:
|
||||
|
||||
HandInterface *myHand;
|
||||
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
int dealerPosition;
|
||||
int smallBlindPosition;
|
||||
|
||||
int smallBlind;
|
||||
int highestSet;
|
||||
|
||||
bool firstFlopRun;
|
||||
bool firstFlopRound;
|
||||
bool firstHeadsUpFlopRound;
|
||||
int playersTurn;
|
||||
|
||||
bool logBoardCardsDone;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,478 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@web.de *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "localberopostriver.h"
|
||||
#include <handinterface.h>
|
||||
#include <game_defs.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
LocalBeRoPostRiver::LocalBeRoPostRiver(HandInterface* bR, int id, int qP, int dP, int sB) : LocalBeRo(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRiverRun(1), firstRiverRound(1), firstHeadsUpRiverRound(1), playersTurn(dP), highestCardsValue(0), logBoardCardsDone(0)
|
||||
|
||||
{
|
||||
|
||||
myBeRoID = GAME_STATE_RIVER;
|
||||
|
||||
int i;
|
||||
|
||||
//SmallBlind-Position ermitteln
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if (myHand->getPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i;
|
||||
}
|
||||
cout << "LocalBeroPostRiver erstellt - " << myBeRoID << endl;
|
||||
}
|
||||
|
||||
LocalBeRoPostRiver::~LocalBeRoPostRiver()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void LocalBeRoPostRiver::riverRun() {
|
||||
|
||||
cout << "LocalBeroPostRiverRun!!!" << endl;
|
||||
int i;
|
||||
|
||||
if (firstRiverRun) {
|
||||
myHand->getGuiInterface()->dealRiverCard();
|
||||
firstRiverRun = 0;
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
//log the turned cards
|
||||
if(!logBoardCardsDone) {
|
||||
int tempBoardCardsArray[5];
|
||||
|
||||
myHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
myHand->getGuiInterface()->logDealBoardCardsMsg(3, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]);
|
||||
logBoardCardsDone = 1;
|
||||
}
|
||||
|
||||
bool allHighestSet = 1;
|
||||
|
||||
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
|
||||
// cout << "Spieler " << i << " Set " << myHand->getPlayerArray()[i]->getMySet() << endl;
|
||||
if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
|
||||
}
|
||||
}
|
||||
// cout << "allHighestSet " << allHighestSet << endl;
|
||||
|
||||
// cout << "firstflopround " << firstRiverRound << endl;
|
||||
|
||||
// prfen, ob River wirklich dran ist
|
||||
if(!firstRiverRound && allHighestSet) {
|
||||
|
||||
// River nicht dran, weil alle Sets gleich sind
|
||||
//also gehe in Turn
|
||||
myHand->setActualRound(4);
|
||||
|
||||
//Action lᅵchen und ActionButtons refresh
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0);
|
||||
}
|
||||
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
|
||||
myHand->getBoard()->collectSets();
|
||||
myHand->getBoard()->collectPot();
|
||||
myHand->getGuiInterface()->refreshPot();
|
||||
|
||||
myHand->getGuiInterface()->refreshSet();
|
||||
myHand->getGuiInterface()->refreshCash();
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { myHand->getGuiInterface()->refreshAction(i,0); }
|
||||
|
||||
|
||||
myHand->switchRounds();
|
||||
}
|
||||
else {
|
||||
// River ist wirklich dran
|
||||
|
||||
// Anzahl der effektiv gespielten Runden (des human player) erhöhen
|
||||
if(myHand->getPlayerArray()[0]->getMyActiveStatus() && myHand->getPlayerArray()[0]->getMyAction() != 1) {
|
||||
myHand->setBettingRoundsPlayed(3);
|
||||
}
|
||||
|
||||
if( !(myHand->getActualQuantityPlayers() < 3 && firstHeadsUpRiverRound == 1) ) {
|
||||
// not first round in heads up (for headsup dealer is smallblind so it is dealers turn)
|
||||
|
||||
// naechsten Spieler ermitteln
|
||||
do { playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||
} while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6);
|
||||
}
|
||||
else { firstHeadsUpRiverRound = 0; }
|
||||
|
||||
//Spieler-Position vor SmallBlind-Position ermitteln
|
||||
int activePlayerBeforeSmallBlind = smallBlindPosition;
|
||||
do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS);
|
||||
} while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6);
|
||||
|
||||
myHand->getPlayerArray()[playersTurn]->setMyTurn(1);
|
||||
//highlight active players groupbox and clear action
|
||||
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
||||
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
||||
|
||||
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
|
||||
// cout << "playersTurn " << playersTurn << endl;
|
||||
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
||||
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstRiverRound = 0; }
|
||||
|
||||
if(playersTurn == 0) {
|
||||
// Wir sind dran
|
||||
// cout << "actualRound " << myHand->getActualRound() << endl;
|
||||
// cout << "highestSet vor meInAction " << highestSet << endl;
|
||||
myHand->getGuiInterface()->meInAction();
|
||||
}
|
||||
else {
|
||||
//Gegner sind dran
|
||||
myHand->getGuiInterface()->riverAnimation2();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LocalBeRoPostRiver::postRiverRun() {
|
||||
|
||||
int i;
|
||||
|
||||
// für die Engine die durchschnittlichen Sets von Player 0 setzen --> UNUSED !!!
|
||||
// if(myID < 5) {
|
||||
// myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyAverageSets())*(myID-1))/myID + (myHand->getPlayerArray()[0]->getMyRoundStartCash()-myHand->getPlayerArray()[0]->getMyCash())/myID);
|
||||
// } else {
|
||||
// myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyAverageSets())*4)/5 + (myHand->getPlayerArray()[0]->getMyRoundStartCash()-myHand->getPlayerArray()[0]->getMyCash())/5);
|
||||
// }
|
||||
|
||||
// cout << myHand->getPlayerArray()[0]->getMyAverageSets() << endl;
|
||||
|
||||
//berechnen welcher Spieler gewonnen hat
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
|
||||
// cout << "Spieler: " << i << " hat: " << myHand->getPlayerArray()[i]->getMyCardsValueInt() << endl;
|
||||
|
||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyCardsValueInt() > highestCardsValue ) {
|
||||
highestCardsValue = myHand->getPlayerArray()[i]->getMyCardsValueInt();
|
||||
}
|
||||
}
|
||||
|
||||
// Durchschnittsets des human player ermitteln
|
||||
myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyRoundStartCash())-(myHand->getPlayerArray()[0]->getMyCash()))/(myHand->getBettingRoundsPlayed()+1));
|
||||
// cout << myHand->getPlayerArray()[0]->getMyAverageSets() << endl;
|
||||
|
||||
// Aggressivität des human player ermitteln
|
||||
// anzahl der player die möglichkeit haben am pot teilzuhaben
|
||||
int potPlayers = 0;
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
potPlayers++;
|
||||
}
|
||||
}
|
||||
|
||||
// prüfen ob nur noch der human player an der verteilung teilnimmt und myAggressive für human player setzen
|
||||
myHand->getPlayerArray()[0]->setMyAggressive(potPlayers == 1 && myHand->getPlayerArray()[0]->getMyActiveStatus() && myHand->getPlayerArray()[0]->getMyAction() != 1);
|
||||
|
||||
// cout << "myAggressive: " << myHand->getPlayerArray()[0]->getMyAggressive() << endl;
|
||||
|
||||
// Pot-Verteilung
|
||||
distributePot();
|
||||
|
||||
//Pot auf 0 setzen
|
||||
myHand->getBoard()->setPot(0);
|
||||
|
||||
//starte die Animaionsreihe
|
||||
myHand->getGuiInterface()->postRiverRunAnimation1();
|
||||
}
|
||||
|
||||
void LocalBeRoPostRiver::nextPlayer2() {
|
||||
|
||||
myHand->getPlayerArray()[playersTurn]->action();
|
||||
|
||||
}
|
||||
|
||||
void LocalBeRoPostRiver::distributePot() {
|
||||
|
||||
// int potCalcAllinArray[5][2]; // 0 -> ID , 1 -> AllInCash
|
||||
|
||||
int i, j;
|
||||
|
||||
////////////////////
|
||||
// (1) EINLEITUNG //
|
||||
////////////////////
|
||||
|
||||
// die Potverteilung gliedert sich in mehrere Runden:
|
||||
// in der ersten Runden sucht sich der Winner der BettingRound seinen zustehenden Anteil am Pot raus. das kann alles oder nur ein Teil sein (z.b. wenn er mit wenig allin gegangen ist und der Rest weitergespielt hat)
|
||||
// in den darauffolgenden Verteilungsrunden suchen sich die jeweils nᅵhsten Winner aus dem noch brig gebliebenen Pot ihren zustehenden Anteil raus
|
||||
// die gesamte Potverteilung ist zuende, wenn der Pot leer ist und nichts mehr zu holen ist
|
||||
|
||||
|
||||
/////////////////////
|
||||
// (2) HILFSMITTEL //
|
||||
/////////////////////
|
||||
|
||||
// winnersArray erstellen -> hier werden die winner der jeweiligen Potverteilungsrunden eingetragen
|
||||
int *winnersArray = new int[MAX_NUMBER_OF_PLAYERS];
|
||||
|
||||
// Anzahl der winner in einer Potverteilungsrunde
|
||||
int winnersCounter = 0;
|
||||
|
||||
// dieses Array ermittelt wieviel jeder Spieler wᅵrend der gesamten BettingRound gesetzt hat
|
||||
int *roundSetArray = new int[MAX_NUMBER_OF_PLAYERS];
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// Standardwert fr nicht mehr aktive
|
||||
roundSetArray[i] = 0;
|
||||
// nur fr die Spieler ermitteln, die noch aktiv sind (inkl. der gefoldeten)
|
||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||
roundSetArray[i] = myHand->getPlayerArray()[i]->getMyRoundStartCash()-myHand->getPlayerArray()[i]->getMyCash();
|
||||
}
|
||||
}
|
||||
|
||||
// hier steht der CardsValue der Spieler drin die an der Potverteilung teilnehmen (d.h. aktiv und nicht gefoldet), bei allen anderen steht ne 0
|
||||
int *cardsValueArray = new int[MAX_NUMBER_OF_PLAYERS];
|
||||
int playerWantsPotCounter = 0;
|
||||
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// Standardwert
|
||||
cardsValueArray[i] = 0;
|
||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
// nur bei den Spielen den Kartenwert eintragen, die an der Potverteilung teilnehmen
|
||||
cardsValueArray[i] = myHand->getPlayerArray()[i]->getMyCardsValueInt();
|
||||
playerWantsPotCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
int winner;
|
||||
int highestCardsValueTemp;
|
||||
|
||||
// fr SplitPotBerechnung;
|
||||
int winnersSets;
|
||||
int winnersMaxSet;
|
||||
int winnersPot;
|
||||
bool playerIsWinner;
|
||||
|
||||
|
||||
|
||||
//////////////////////
|
||||
// (3) DIE SCHLEIFE //
|
||||
//////////////////////
|
||||
|
||||
|
||||
// Potverteilungsrunden -> solange noch was aus dem pot zu vergeben ist
|
||||
while(playerWantsPotCounter != 0 ) {
|
||||
|
||||
// highestCardsValueTemp zu Beginn der aktuellen Potverteilungsrunde auf Null setzen
|
||||
highestCardsValueTemp = 0;
|
||||
|
||||
// aktuellen highestCardsValueTemp berechnen, von denen die noch an der Potverteilung teilnehmen
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(cardsValueArray[i] > highestCardsValueTemp ) {
|
||||
highestCardsValueTemp = myHand->getPlayerArray()[i]->getMyCardsValueInt();
|
||||
}
|
||||
}
|
||||
|
||||
// zu Beginn der Potverteilungsrunde die Anzahl der winner auf 0 setzen
|
||||
winnersCounter = 0;
|
||||
// Siegerposition und -anzahl von denen ermitteln, die noch an der Potverteilung teilnehmen
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(cardsValueArray[i] == highestCardsValueTemp ) {
|
||||
winnersArray[winnersCounter] = i;
|
||||
winnersCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// A) nur einer hat aktulle Potverteilungsrunde gewonnen gewonnen
|
||||
// --------------------------------------------------------------
|
||||
if(winnersCounter == 1) {
|
||||
|
||||
// winnerID ist an der ersten Stelle im winnersArray
|
||||
winner = winnersArray[0];
|
||||
|
||||
// Winner ist nicht All In gegangen -> bekommt den gesamten Pot
|
||||
// if(myHand->getPlayerArray()[winner]->getMyAction() != 6) {
|
||||
//
|
||||
// myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+myHand->getBoard()->getPot());
|
||||
// myHand->getBoard()->setPot(0);
|
||||
// playerWantsPotCounter = 1;
|
||||
//
|
||||
// }
|
||||
// Winner ist All In gegangen -> von denen die weniger gesetzt oder gefoldet hatten alles nehmen und von denen die mehr gesetzt hatten nur die eigenen Sets nehmen
|
||||
// else {
|
||||
|
||||
// alle Spieler nacheinander durchgehen und prfen von wem man wieviel Geld aus dem Pot bekommt
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
|
||||
// zuerst prfen ob ein gefoldeter Spieler was gesetzt hatte
|
||||
if(i != winner && myHand->getPlayerArray()[i]->getMyAction() == 1) {
|
||||
|
||||
// diesen Teil aus dem Pot holen
|
||||
myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+roundSetArray[i]);
|
||||
// Pot dementsprechend verkleinern
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - roundSetArray[i]);
|
||||
// deren Sets auf Null seztzen -> in den nᅵhsten Potverteilungsrunden nimmt der Winner dann von diesen Spielern 0 Dollar aus dem Pot
|
||||
roundSetArray[i] = 0;
|
||||
|
||||
}
|
||||
|
||||
// nun nur von den Spielern holen, die noch an der Potverteilung teilnehmen und natrlich nicht von einem selber
|
||||
if(i != winner && cardsValueArray[i] != 0) {
|
||||
|
||||
// zuerst alle rauspicken, die weniger oder das gleiche gesetzt hatten
|
||||
if(roundSetArray[winner] >= roundSetArray[i]) {
|
||||
|
||||
// von denen alles holen
|
||||
myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+roundSetArray[i]);
|
||||
// Pot dementsprechend verkleinern
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - roundSetArray[i]);
|
||||
// diese Spieler dann von der weiteren Potverteilung ausschlieᅵn
|
||||
cardsValueArray[i] = 0;
|
||||
playerWantsPotCounter--;
|
||||
// deren Sets auf Null seztzen, da sie schon alles abgegeben haben
|
||||
roundSetArray[i] = 0;
|
||||
|
||||
}
|
||||
// nun alle Spieler die mehr gesetzt hatten
|
||||
else {
|
||||
|
||||
// den eigenen Setanteil aus dem Pot holen
|
||||
myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+roundSetArray[winner]);
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - roundSetArray[winner]);
|
||||
// den Set des Gegners um den bereits abgenommenen Setanteil verkleinern
|
||||
roundSetArray[i] = roundSetArray[i] - roundSetArray[winner];
|
||||
// diese Spieler nehmen an der weiteren Potverteilung teil
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// // }
|
||||
|
||||
// zum Scluss noch eingenen Set wieder holen
|
||||
myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+roundSetArray[winner]);
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - roundSetArray[winner]);
|
||||
// nicht mehr an der weiteren Potverteilung teilnehmen, da man sich alles geholt hat was einem zusteht
|
||||
cardsValueArray[winner] = 0;
|
||||
playerWantsPotCounter--;
|
||||
// eigene Sets auf Null seztzen, da sie eben eingesammelt wurden
|
||||
roundSetArray[winner] = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// B) mehrere haben die aktuelle Potverteilungsrunde gewonnen -> SplitPot
|
||||
// ----------------------------------------------------------------------
|
||||
else {
|
||||
|
||||
// hierfr wird ein temporᅵer WinnersPot erstellt; dort flieᅵn erstmal alle zustehenden Anteile aus dem Pot rauf; am Ende wird dies auf die Winners verteilt
|
||||
winnersPot = 0;
|
||||
// hᅵhster Set aller Winner
|
||||
winnersMaxSet = 0;
|
||||
|
||||
// den hᅵhsten Set aller Winner ermitteln
|
||||
for(i=0; i<winnersCounter; i++) {
|
||||
if(roundSetArray[winnersArray[i]] > winnersMaxSet) winnersMaxSet = roundSetArray[i];
|
||||
}
|
||||
|
||||
// gesamtSet aller Winner
|
||||
winnersSets = 0;
|
||||
for(i=0; i<winnersCounter; i++) {
|
||||
winnersSets += roundSetArray[winnersArray[i]];
|
||||
}
|
||||
|
||||
// alle Spieler nacheinander durchgehen und prfen von wem die Winner wieviel Geld aus dem Pot bekommen
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
|
||||
// prfen ob Spieler i zu den Winnern gehᅵt
|
||||
playerIsWinner = 0;
|
||||
for(j=0; j<winnersCounter; j++) {
|
||||
if(winnersArray[j] == i) playerIsWinner = 1; // -> Spieler i gehᅵt zu den Winnern
|
||||
}
|
||||
|
||||
// zuerst prfen ob ein gefoldeter Spieler was gesetzt hatte
|
||||
if(!playerIsWinner && myHand->getPlayerArray()[i]->getMyAction() == 1) {
|
||||
|
||||
// diesen Teil aus dem Pot holen und dem winnersPot geben
|
||||
winnersPot += roundSetArray[i];
|
||||
// Pot dementsprechend verkleinern
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - roundSetArray[i]);
|
||||
// deren Sets auf Null seztzen -> in den nᅵhsten Potverteilungsrunden nehmen die Winner dann von diesen Spielern 0 Dollar aus dem Pot
|
||||
roundSetArray[i] = 0;
|
||||
|
||||
}
|
||||
|
||||
// nun nur von den Spielern holen, die noch an der Potverteilung teilnehmen und natrlich nicht zu den Winnern gehᅵen
|
||||
if(!playerIsWinner && cardsValueArray[i] != 0) {
|
||||
|
||||
// zuerst alle rauspicken, die weniger oder das gleiche gesetzt hatten
|
||||
if(winnersMaxSet >= roundSetArray[i]) {
|
||||
|
||||
// von denen alles holen
|
||||
winnersPot += roundSetArray[i];
|
||||
// Pot dementsprechend verkleinern
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - roundSetArray[i]);
|
||||
// diese Spieler dann von der weiteren Potverteilung ausschlieᅵn
|
||||
cardsValueArray[i] = 0;
|
||||
playerWantsPotCounter--;
|
||||
// deren Sets auf Null seztzen, da sie schon alles abgegeben haben
|
||||
roundSetArray[i] = 0;
|
||||
|
||||
}
|
||||
// nun alle Spieler die mehr gesetzt hatten
|
||||
else {
|
||||
|
||||
// den eigenen Setanteil aus dem Pot holen
|
||||
winnersPot += winnersMaxSet;
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - winnersMaxSet);
|
||||
// den Set des Gegners um den bereits abgenommenen Setanteil verkleinern
|
||||
roundSetArray[i] = roundSetArray[i] - winnersMaxSet;
|
||||
// diese Spieler nehmen an der weiteren Potverteilung teil
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// zum Schluss noch die eingenen Set aus dem Pot holen
|
||||
winnersPot += winnersSets;
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - winnersSets);
|
||||
|
||||
// winnersPot verteilen (anteilmᅵig)
|
||||
for(i=0; i<winnersCounter; i++) {
|
||||
myHand->getPlayerArray()[winnersArray[i]]->setMyCash(myHand->getPlayerArray()[winnersArray[i]]->getMyCash()+((roundSetArray[winnersArray[i]]*winnersPot)/winnersSets));
|
||||
}
|
||||
|
||||
|
||||
for(i=0; i<winnersCounter; i++) {
|
||||
// nicht mehr an der weiteren Potverteilung teilnehmen, da man sich alle Winner dieser Verteilungsrunde ihren Anteil geholt haben
|
||||
cardsValueArray[winnersArray[i]] = 0;
|
||||
playerWantsPotCounter--;
|
||||
// Sets auf Null seztzen, da sie eben eingesammelt wurden
|
||||
roundSetArray[winnersArray[i]] = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(myHand->getBoard()->getPot() != 0) cout << "!!! Pot: " << myHand->getBoard()->getPot() << endl;
|
||||
|
||||
delete[] winnersArray;
|
||||
delete[] roundSetArray;
|
||||
delete[] cardsValueArray;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@web.de *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef LOCALBEROPOSTRIVER_H
|
||||
#define LOCALBEROPOSTRIVER_H
|
||||
|
||||
#include <iostream>
|
||||
#include <localbero.h>
|
||||
|
||||
class HandInterface;
|
||||
|
||||
|
||||
class LocalBeRoPostRiver : public LocalBeRo{
|
||||
public:
|
||||
LocalBeRoPostRiver(HandInterface*, int, int, int, int);
|
||||
~LocalBeRoPostRiver();
|
||||
|
||||
void setPlayersTurn(int theValue) { playersTurn = theValue; }
|
||||
int getPlayersTurn() const { return playersTurn; }
|
||||
|
||||
void setHighestSet(int theValue) { highestSet = theValue; }
|
||||
int getHighestSet() const { return highestSet;}
|
||||
|
||||
void setFirstRiverRound(bool theValue) { firstRiverRound = theValue;}
|
||||
bool getFirstRiverRound() const { return firstRiverRound;}
|
||||
|
||||
void setSmallBlindPosition(int theValue) { smallBlindPosition = theValue;}
|
||||
int getSmallBlindPosition() const { return smallBlindPosition; }
|
||||
|
||||
void setSmallBlind(int theValue) { smallBlind = theValue; }
|
||||
int getSmallBlind() const { return smallBlind; }
|
||||
|
||||
void setHighestCardsValue(int theValue) { highestCardsValue = theValue;}
|
||||
int getHighestCardsValue() const { return highestCardsValue;}
|
||||
|
||||
void resetFirstRun() { firstRiverRun = false; }
|
||||
|
||||
void riverRun();
|
||||
void postRiverRun();
|
||||
void nextPlayer2();
|
||||
void distributePot();
|
||||
|
||||
//only until bero refactory is over
|
||||
void preflopRun() {}
|
||||
void turnRun() {}
|
||||
void flopRun() {}
|
||||
|
||||
private:
|
||||
|
||||
HandInterface *myHand;
|
||||
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
int dealerPosition;
|
||||
int smallBlindPosition;
|
||||
|
||||
int smallBlind;
|
||||
int highestSet;
|
||||
|
||||
bool firstRiverRun;
|
||||
bool firstRiverRound;
|
||||
bool firstHeadsUpRiverRound;
|
||||
int playersTurn;
|
||||
|
||||
int highestCardsValue;
|
||||
|
||||
bool logBoardCardsDone;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -27,6 +27,8 @@ using namespace std;
|
||||
LocalBeRoPreflop::LocalBeRoPreflop(HandInterface* bR, int id, int qP, int dP, int sB) : LocalBeRo(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), bigBlindPosition(0), smallBlind(sB), highestSet(2*sB), preflopFirstRound(1), playersTurn(0)
|
||||
|
||||
{
|
||||
myBeRoID = GAME_STATE_PREFLOP;
|
||||
|
||||
// // BigBlind ermitteln
|
||||
bigBlindPosition = dealerPosition;
|
||||
while (myHand->getPlayerArray()[bigBlindPosition]->getMyButton() != 3) {
|
||||
@@ -36,7 +38,7 @@ LocalBeRoPreflop::LocalBeRoPreflop(HandInterface* bR, int id, int qP, int dP, in
|
||||
// // erste Spielernummer fr preflopRun() setzen
|
||||
playersTurn = bigBlindPosition;
|
||||
|
||||
cout << "LocalBeroPreflop erstellt" << endl;
|
||||
cout << "LocalBeroPreflop erstellt - " << myBeRoID << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,17 +38,20 @@ public:
|
||||
void setHighestSet(int theValue) { highestSet = theValue; }
|
||||
int getHighestSet() const { return highestSet;}
|
||||
|
||||
void setPreflopFirstRound(bool theValue) { preflopFirstRound = theValue; }
|
||||
bool setPreflopFirstRound() const { return preflopFirstRound; }
|
||||
|
||||
void preflopRun();
|
||||
void nextPlayer2();
|
||||
|
||||
|
||||
//only until bero refactory is over
|
||||
void flopRun() {}
|
||||
void turnRun() {}
|
||||
void riverRun() {}
|
||||
void postRiverRun() {}
|
||||
|
||||
|
||||
private:
|
||||
HandInterface *myHand;
|
||||
|
||||
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
int dealerPosition;
|
||||
|
||||
@@ -0,0 +1,478 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@web.de *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "localberoriver.h"
|
||||
#include <handinterface.h>
|
||||
#include <game_defs.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
LocalBeRoRiver::LocalBeRoRiver(HandInterface* bR, int id, int qP, int dP, int sB) : LocalBeRo(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRiverRun(1), firstRiverRound(1), firstHeadsUpRiverRound(1), playersTurn(dP), highestCardsValue(0), logBoardCardsDone(0)
|
||||
|
||||
{
|
||||
|
||||
myBeRoID = GAME_STATE_RIVER;
|
||||
|
||||
int i;
|
||||
|
||||
//SmallBlind-Position ermitteln
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if (myHand->getPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i;
|
||||
}
|
||||
cout << "LocalBeroRiver erstellt - " << myBeRoID << endl;
|
||||
}
|
||||
|
||||
LocalBeRoRiver::~LocalBeRoRiver()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void LocalBeRoRiver::riverRun() {
|
||||
|
||||
cout << "LocalBeroRiverRun!!!" << endl;
|
||||
int i;
|
||||
|
||||
if (firstRiverRun) {
|
||||
myHand->getGuiInterface()->dealRiverCard();
|
||||
firstRiverRun = 0;
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
//log the turned cards
|
||||
if(!logBoardCardsDone) {
|
||||
int tempBoardCardsArray[5];
|
||||
|
||||
myHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
myHand->getGuiInterface()->logDealBoardCardsMsg(3, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]);
|
||||
logBoardCardsDone = 1;
|
||||
}
|
||||
|
||||
bool allHighestSet = 1;
|
||||
|
||||
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
|
||||
// cout << "Spieler " << i << " Set " << myHand->getPlayerArray()[i]->getMySet() << endl;
|
||||
if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
|
||||
}
|
||||
}
|
||||
// cout << "allHighestSet " << allHighestSet << endl;
|
||||
|
||||
// cout << "firstflopround " << firstRiverRound << endl;
|
||||
|
||||
// prfen, ob River wirklich dran ist
|
||||
if(!firstRiverRound && allHighestSet) {
|
||||
|
||||
// River nicht dran, weil alle Sets gleich sind
|
||||
//also gehe in Turn
|
||||
myHand->setActualRound(4);
|
||||
|
||||
//Action lᅵchen und ActionButtons refresh
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0);
|
||||
}
|
||||
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
|
||||
myHand->getBoard()->collectSets();
|
||||
myHand->getBoard()->collectPot();
|
||||
myHand->getGuiInterface()->refreshPot();
|
||||
|
||||
myHand->getGuiInterface()->refreshSet();
|
||||
myHand->getGuiInterface()->refreshCash();
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { myHand->getGuiInterface()->refreshAction(i,0); }
|
||||
|
||||
|
||||
myHand->switchRounds();
|
||||
}
|
||||
else {
|
||||
// River ist wirklich dran
|
||||
|
||||
// Anzahl der effektiv gespielten Runden (des human player) erhöhen
|
||||
if(myHand->getPlayerArray()[0]->getMyActiveStatus() && myHand->getPlayerArray()[0]->getMyAction() != 1) {
|
||||
myHand->setBettingRoundsPlayed(3);
|
||||
}
|
||||
|
||||
if( !(myHand->getActualQuantityPlayers() < 3 && firstHeadsUpRiverRound == 1) ) {
|
||||
// not first round in heads up (for headsup dealer is smallblind so it is dealers turn)
|
||||
|
||||
// naechsten Spieler ermitteln
|
||||
do { playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||
} while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6);
|
||||
}
|
||||
else { firstHeadsUpRiverRound = 0; }
|
||||
|
||||
//Spieler-Position vor SmallBlind-Position ermitteln
|
||||
int activePlayerBeforeSmallBlind = smallBlindPosition;
|
||||
do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS);
|
||||
} while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6);
|
||||
|
||||
myHand->getPlayerArray()[playersTurn]->setMyTurn(1);
|
||||
//highlight active players groupbox and clear action
|
||||
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
||||
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
||||
|
||||
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
|
||||
// cout << "playersTurn " << playersTurn << endl;
|
||||
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
||||
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstRiverRound = 0; }
|
||||
|
||||
if(playersTurn == 0) {
|
||||
// Wir sind dran
|
||||
// cout << "actualRound " << myHand->getActualRound() << endl;
|
||||
// cout << "highestSet vor meInAction " << highestSet << endl;
|
||||
myHand->getGuiInterface()->meInAction();
|
||||
}
|
||||
else {
|
||||
//Gegner sind dran
|
||||
myHand->getGuiInterface()->riverAnimation2();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LocalBeRoRiver::postRiverRun() {
|
||||
|
||||
int i;
|
||||
|
||||
// für die Engine die durchschnittlichen Sets von Player 0 setzen --> UNUSED !!!
|
||||
// if(myID < 5) {
|
||||
// myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyAverageSets())*(myID-1))/myID + (myHand->getPlayerArray()[0]->getMyRoundStartCash()-myHand->getPlayerArray()[0]->getMyCash())/myID);
|
||||
// } else {
|
||||
// myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyAverageSets())*4)/5 + (myHand->getPlayerArray()[0]->getMyRoundStartCash()-myHand->getPlayerArray()[0]->getMyCash())/5);
|
||||
// }
|
||||
|
||||
// cout << myHand->getPlayerArray()[0]->getMyAverageSets() << endl;
|
||||
|
||||
//berechnen welcher Spieler gewonnen hat
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
|
||||
// cout << "Spieler: " << i << " hat: " << myHand->getPlayerArray()[i]->getMyCardsValueInt() << endl;
|
||||
|
||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyCardsValueInt() > highestCardsValue ) {
|
||||
highestCardsValue = myHand->getPlayerArray()[i]->getMyCardsValueInt();
|
||||
}
|
||||
}
|
||||
|
||||
// Durchschnittsets des human player ermitteln
|
||||
myHand->getPlayerArray()[0]->setMyAverageSets(((myHand->getPlayerArray()[0]->getMyRoundStartCash())-(myHand->getPlayerArray()[0]->getMyCash()))/(myHand->getBettingRoundsPlayed()+1));
|
||||
// cout << myHand->getPlayerArray()[0]->getMyAverageSets() << endl;
|
||||
|
||||
// Aggressivität des human player ermitteln
|
||||
// anzahl der player die möglichkeit haben am pot teilzuhaben
|
||||
int potPlayers = 0;
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
potPlayers++;
|
||||
}
|
||||
}
|
||||
|
||||
// prüfen ob nur noch der human player an der verteilung teilnimmt und myAggressive für human player setzen
|
||||
myHand->getPlayerArray()[0]->setMyAggressive(potPlayers == 1 && myHand->getPlayerArray()[0]->getMyActiveStatus() && myHand->getPlayerArray()[0]->getMyAction() != 1);
|
||||
|
||||
// cout << "myAggressive: " << myHand->getPlayerArray()[0]->getMyAggressive() << endl;
|
||||
|
||||
// Pot-Verteilung
|
||||
distributePot();
|
||||
|
||||
//Pot auf 0 setzen
|
||||
myHand->getBoard()->setPot(0);
|
||||
|
||||
//starte die Animaionsreihe
|
||||
myHand->getGuiInterface()->postRiverRunAnimation1();
|
||||
}
|
||||
|
||||
void LocalBeRoRiver::nextPlayer2() {
|
||||
|
||||
myHand->getPlayerArray()[playersTurn]->action();
|
||||
|
||||
}
|
||||
|
||||
void LocalBeRoRiver::distributePot() {
|
||||
|
||||
// int potCalcAllinArray[5][2]; // 0 -> ID , 1 -> AllInCash
|
||||
|
||||
int i, j;
|
||||
|
||||
////////////////////
|
||||
// (1) EINLEITUNG //
|
||||
////////////////////
|
||||
|
||||
// die Potverteilung gliedert sich in mehrere Runden:
|
||||
// in der ersten Runden sucht sich der Winner der BettingRound seinen zustehenden Anteil am Pot raus. das kann alles oder nur ein Teil sein (z.b. wenn er mit wenig allin gegangen ist und der Rest weitergespielt hat)
|
||||
// in den darauffolgenden Verteilungsrunden suchen sich die jeweils nᅵhsten Winner aus dem noch brig gebliebenen Pot ihren zustehenden Anteil raus
|
||||
// die gesamte Potverteilung ist zuende, wenn der Pot leer ist und nichts mehr zu holen ist
|
||||
|
||||
|
||||
/////////////////////
|
||||
// (2) HILFSMITTEL //
|
||||
/////////////////////
|
||||
|
||||
// winnersArray erstellen -> hier werden die winner der jeweiligen Potverteilungsrunden eingetragen
|
||||
int *winnersArray = new int[MAX_NUMBER_OF_PLAYERS];
|
||||
|
||||
// Anzahl der winner in einer Potverteilungsrunde
|
||||
int winnersCounter = 0;
|
||||
|
||||
// dieses Array ermittelt wieviel jeder Spieler wᅵrend der gesamten BettingRound gesetzt hat
|
||||
int *roundSetArray = new int[MAX_NUMBER_OF_PLAYERS];
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// Standardwert fr nicht mehr aktive
|
||||
roundSetArray[i] = 0;
|
||||
// nur fr die Spieler ermitteln, die noch aktiv sind (inkl. der gefoldeten)
|
||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||
roundSetArray[i] = myHand->getPlayerArray()[i]->getMyRoundStartCash()-myHand->getPlayerArray()[i]->getMyCash();
|
||||
}
|
||||
}
|
||||
|
||||
// hier steht der CardsValue der Spieler drin die an der Potverteilung teilnehmen (d.h. aktiv und nicht gefoldet), bei allen anderen steht ne 0
|
||||
int *cardsValueArray = new int[MAX_NUMBER_OF_PLAYERS];
|
||||
int playerWantsPotCounter = 0;
|
||||
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// Standardwert
|
||||
cardsValueArray[i] = 0;
|
||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1) {
|
||||
// nur bei den Spielen den Kartenwert eintragen, die an der Potverteilung teilnehmen
|
||||
cardsValueArray[i] = myHand->getPlayerArray()[i]->getMyCardsValueInt();
|
||||
playerWantsPotCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
int winner;
|
||||
int highestCardsValueTemp;
|
||||
|
||||
// fr SplitPotBerechnung;
|
||||
int winnersSets;
|
||||
int winnersMaxSet;
|
||||
int winnersPot;
|
||||
bool playerIsWinner;
|
||||
|
||||
|
||||
|
||||
//////////////////////
|
||||
// (3) DIE SCHLEIFE //
|
||||
//////////////////////
|
||||
|
||||
|
||||
// Potverteilungsrunden -> solange noch was aus dem pot zu vergeben ist
|
||||
while(playerWantsPotCounter != 0 ) {
|
||||
|
||||
// highestCardsValueTemp zu Beginn der aktuellen Potverteilungsrunde auf Null setzen
|
||||
highestCardsValueTemp = 0;
|
||||
|
||||
// aktuellen highestCardsValueTemp berechnen, von denen die noch an der Potverteilung teilnehmen
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(cardsValueArray[i] > highestCardsValueTemp ) {
|
||||
highestCardsValueTemp = myHand->getPlayerArray()[i]->getMyCardsValueInt();
|
||||
}
|
||||
}
|
||||
|
||||
// zu Beginn der Potverteilungsrunde die Anzahl der winner auf 0 setzen
|
||||
winnersCounter = 0;
|
||||
// Siegerposition und -anzahl von denen ermitteln, die noch an der Potverteilung teilnehmen
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(cardsValueArray[i] == highestCardsValueTemp ) {
|
||||
winnersArray[winnersCounter] = i;
|
||||
winnersCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// A) nur einer hat aktulle Potverteilungsrunde gewonnen gewonnen
|
||||
// --------------------------------------------------------------
|
||||
if(winnersCounter == 1) {
|
||||
|
||||
// winnerID ist an der ersten Stelle im winnersArray
|
||||
winner = winnersArray[0];
|
||||
|
||||
// Winner ist nicht All In gegangen -> bekommt den gesamten Pot
|
||||
// if(myHand->getPlayerArray()[winner]->getMyAction() != 6) {
|
||||
//
|
||||
// myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+myHand->getBoard()->getPot());
|
||||
// myHand->getBoard()->setPot(0);
|
||||
// playerWantsPotCounter = 1;
|
||||
//
|
||||
// }
|
||||
// Winner ist All In gegangen -> von denen die weniger gesetzt oder gefoldet hatten alles nehmen und von denen die mehr gesetzt hatten nur die eigenen Sets nehmen
|
||||
// else {
|
||||
|
||||
// alle Spieler nacheinander durchgehen und prfen von wem man wieviel Geld aus dem Pot bekommt
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
|
||||
// zuerst prfen ob ein gefoldeter Spieler was gesetzt hatte
|
||||
if(i != winner && myHand->getPlayerArray()[i]->getMyAction() == 1) {
|
||||
|
||||
// diesen Teil aus dem Pot holen
|
||||
myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+roundSetArray[i]);
|
||||
// Pot dementsprechend verkleinern
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - roundSetArray[i]);
|
||||
// deren Sets auf Null seztzen -> in den nᅵhsten Potverteilungsrunden nimmt der Winner dann von diesen Spielern 0 Dollar aus dem Pot
|
||||
roundSetArray[i] = 0;
|
||||
|
||||
}
|
||||
|
||||
// nun nur von den Spielern holen, die noch an der Potverteilung teilnehmen und natrlich nicht von einem selber
|
||||
if(i != winner && cardsValueArray[i] != 0) {
|
||||
|
||||
// zuerst alle rauspicken, die weniger oder das gleiche gesetzt hatten
|
||||
if(roundSetArray[winner] >= roundSetArray[i]) {
|
||||
|
||||
// von denen alles holen
|
||||
myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+roundSetArray[i]);
|
||||
// Pot dementsprechend verkleinern
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - roundSetArray[i]);
|
||||
// diese Spieler dann von der weiteren Potverteilung ausschlieᅵn
|
||||
cardsValueArray[i] = 0;
|
||||
playerWantsPotCounter--;
|
||||
// deren Sets auf Null seztzen, da sie schon alles abgegeben haben
|
||||
roundSetArray[i] = 0;
|
||||
|
||||
}
|
||||
// nun alle Spieler die mehr gesetzt hatten
|
||||
else {
|
||||
|
||||
// den eigenen Setanteil aus dem Pot holen
|
||||
myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+roundSetArray[winner]);
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - roundSetArray[winner]);
|
||||
// den Set des Gegners um den bereits abgenommenen Setanteil verkleinern
|
||||
roundSetArray[i] = roundSetArray[i] - roundSetArray[winner];
|
||||
// diese Spieler nehmen an der weiteren Potverteilung teil
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// // }
|
||||
|
||||
// zum Scluss noch eingenen Set wieder holen
|
||||
myHand->getPlayerArray()[winner]->setMyCash(myHand->getPlayerArray()[winner]->getMyCash()+roundSetArray[winner]);
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - roundSetArray[winner]);
|
||||
// nicht mehr an der weiteren Potverteilung teilnehmen, da man sich alles geholt hat was einem zusteht
|
||||
cardsValueArray[winner] = 0;
|
||||
playerWantsPotCounter--;
|
||||
// eigene Sets auf Null seztzen, da sie eben eingesammelt wurden
|
||||
roundSetArray[winner] = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// B) mehrere haben die aktuelle Potverteilungsrunde gewonnen -> SplitPot
|
||||
// ----------------------------------------------------------------------
|
||||
else {
|
||||
|
||||
// hierfr wird ein temporᅵer WinnersPot erstellt; dort flieᅵn erstmal alle zustehenden Anteile aus dem Pot rauf; am Ende wird dies auf die Winners verteilt
|
||||
winnersPot = 0;
|
||||
// hᅵhster Set aller Winner
|
||||
winnersMaxSet = 0;
|
||||
|
||||
// den hᅵhsten Set aller Winner ermitteln
|
||||
for(i=0; i<winnersCounter; i++) {
|
||||
if(roundSetArray[winnersArray[i]] > winnersMaxSet) winnersMaxSet = roundSetArray[i];
|
||||
}
|
||||
|
||||
// gesamtSet aller Winner
|
||||
winnersSets = 0;
|
||||
for(i=0; i<winnersCounter; i++) {
|
||||
winnersSets += roundSetArray[winnersArray[i]];
|
||||
}
|
||||
|
||||
// alle Spieler nacheinander durchgehen und prfen von wem die Winner wieviel Geld aus dem Pot bekommen
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
|
||||
// prfen ob Spieler i zu den Winnern gehᅵt
|
||||
playerIsWinner = 0;
|
||||
for(j=0; j<winnersCounter; j++) {
|
||||
if(winnersArray[j] == i) playerIsWinner = 1; // -> Spieler i gehᅵt zu den Winnern
|
||||
}
|
||||
|
||||
// zuerst prfen ob ein gefoldeter Spieler was gesetzt hatte
|
||||
if(!playerIsWinner && myHand->getPlayerArray()[i]->getMyAction() == 1) {
|
||||
|
||||
// diesen Teil aus dem Pot holen und dem winnersPot geben
|
||||
winnersPot += roundSetArray[i];
|
||||
// Pot dementsprechend verkleinern
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - roundSetArray[i]);
|
||||
// deren Sets auf Null seztzen -> in den nᅵhsten Potverteilungsrunden nehmen die Winner dann von diesen Spielern 0 Dollar aus dem Pot
|
||||
roundSetArray[i] = 0;
|
||||
|
||||
}
|
||||
|
||||
// nun nur von den Spielern holen, die noch an der Potverteilung teilnehmen und natrlich nicht zu den Winnern gehᅵen
|
||||
if(!playerIsWinner && cardsValueArray[i] != 0) {
|
||||
|
||||
// zuerst alle rauspicken, die weniger oder das gleiche gesetzt hatten
|
||||
if(winnersMaxSet >= roundSetArray[i]) {
|
||||
|
||||
// von denen alles holen
|
||||
winnersPot += roundSetArray[i];
|
||||
// Pot dementsprechend verkleinern
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - roundSetArray[i]);
|
||||
// diese Spieler dann von der weiteren Potverteilung ausschlieᅵn
|
||||
cardsValueArray[i] = 0;
|
||||
playerWantsPotCounter--;
|
||||
// deren Sets auf Null seztzen, da sie schon alles abgegeben haben
|
||||
roundSetArray[i] = 0;
|
||||
|
||||
}
|
||||
// nun alle Spieler die mehr gesetzt hatten
|
||||
else {
|
||||
|
||||
// den eigenen Setanteil aus dem Pot holen
|
||||
winnersPot += winnersMaxSet;
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - winnersMaxSet);
|
||||
// den Set des Gegners um den bereits abgenommenen Setanteil verkleinern
|
||||
roundSetArray[i] = roundSetArray[i] - winnersMaxSet;
|
||||
// diese Spieler nehmen an der weiteren Potverteilung teil
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// zum Schluss noch die eingenen Set aus dem Pot holen
|
||||
winnersPot += winnersSets;
|
||||
myHand->getBoard()->setPot(myHand->getBoard()->getPot() - winnersSets);
|
||||
|
||||
// winnersPot verteilen (anteilmᅵig)
|
||||
for(i=0; i<winnersCounter; i++) {
|
||||
myHand->getPlayerArray()[winnersArray[i]]->setMyCash(myHand->getPlayerArray()[winnersArray[i]]->getMyCash()+((roundSetArray[winnersArray[i]]*winnersPot)/winnersSets));
|
||||
}
|
||||
|
||||
|
||||
for(i=0; i<winnersCounter; i++) {
|
||||
// nicht mehr an der weiteren Potverteilung teilnehmen, da man sich alle Winner dieser Verteilungsrunde ihren Anteil geholt haben
|
||||
cardsValueArray[winnersArray[i]] = 0;
|
||||
playerWantsPotCounter--;
|
||||
// Sets auf Null seztzen, da sie eben eingesammelt wurden
|
||||
roundSetArray[winnersArray[i]] = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(myHand->getBoard()->getPot() != 0) cout << "!!! Pot: " << myHand->getBoard()->getPot() << endl;
|
||||
|
||||
delete[] winnersArray;
|
||||
delete[] roundSetArray;
|
||||
delete[] cardsValueArray;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@web.de *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef LOCALBERORIVER_H
|
||||
#define LOCALBERORIVER_H
|
||||
|
||||
#include <iostream>
|
||||
#include <localbero.h>
|
||||
|
||||
class HandInterface;
|
||||
|
||||
|
||||
class LocalBeRoRiver : public LocalBeRo{
|
||||
public:
|
||||
LocalBeRoRiver(HandInterface*, int, int, int, int);
|
||||
~LocalBeRoRiver();
|
||||
|
||||
void setPlayersTurn(int theValue) { playersTurn = theValue; }
|
||||
int getPlayersTurn() const { return playersTurn; }
|
||||
|
||||
void setHighestSet(int theValue) { highestSet = theValue; }
|
||||
int getHighestSet() const { return highestSet;}
|
||||
|
||||
void setFirstRiverRound(bool theValue) { firstRiverRound = theValue;}
|
||||
bool getFirstRiverRound() const { return firstRiverRound;}
|
||||
|
||||
void setSmallBlindPosition(int theValue) { smallBlindPosition = theValue;}
|
||||
int getSmallBlindPosition() const { return smallBlindPosition; }
|
||||
|
||||
void setSmallBlind(int theValue) { smallBlind = theValue; }
|
||||
int getSmallBlind() const { return smallBlind; }
|
||||
|
||||
void setHighestCardsValue(int theValue) { highestCardsValue = theValue;}
|
||||
int getHighestCardsValue() const { return highestCardsValue;}
|
||||
|
||||
void resetFirstRun() { firstRiverRun = false; }
|
||||
|
||||
void riverRun();
|
||||
void postRiverRun();
|
||||
void nextPlayer2();
|
||||
void distributePot();
|
||||
|
||||
//only until bero refactory is over
|
||||
void preflopRun() {}
|
||||
void flopRun() {}
|
||||
void turnRun() {}
|
||||
|
||||
private:
|
||||
|
||||
HandInterface *myHand;
|
||||
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
int dealerPosition;
|
||||
int smallBlindPosition;
|
||||
|
||||
int smallBlind;
|
||||
int highestSet;
|
||||
|
||||
bool firstRiverRun;
|
||||
bool firstRiverRound;
|
||||
bool firstHeadsUpRiverRound;
|
||||
int playersTurn;
|
||||
|
||||
int highestCardsValue;
|
||||
|
||||
bool logBoardCardsDone;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,158 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@web.de *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "localberoturn.h"
|
||||
#include <handinterface.h>
|
||||
#include <game_defs.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
LocalBeRoTurn::LocalBeRoTurn(HandInterface* bR, int id, int qP, int dP, int sB) : LocalBeRo(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstTurnRun(1), firstTurnRound(1), firstHeadsUpTurnRound(1), playersTurn(dP), logBoardCardsDone(0)
|
||||
|
||||
{
|
||||
|
||||
myBeRoID = GAME_STATE_TURN;
|
||||
|
||||
int i;
|
||||
|
||||
//SmallBlind-Position ermitteln
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if (myHand->getPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i;
|
||||
}
|
||||
|
||||
cout << "LocalBeroTurn erstellt - " << myBeRoID << endl;
|
||||
|
||||
}
|
||||
|
||||
LocalBeRoTurn::~LocalBeRoTurn()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void LocalBeRoTurn::turnRun() {
|
||||
|
||||
cout << "LocalBeroTurnRun!!!" << endl;
|
||||
int i;
|
||||
|
||||
if (firstTurnRun) {
|
||||
myHand->getGuiInterface()->dealTurnCard();
|
||||
firstTurnRun = 0;
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
//log the turned cards
|
||||
if(!logBoardCardsDone) {
|
||||
int tempBoardCardsArray[5];
|
||||
|
||||
myHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
myHand->getGuiInterface()->logDealBoardCardsMsg(2, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3]);
|
||||
logBoardCardsDone = 1;
|
||||
}
|
||||
|
||||
bool allHighestSet = 1;
|
||||
|
||||
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
|
||||
// cout << "Spieler " << i << " Set " << myHand->getPlayerArray()[i]->getMySet() << endl;
|
||||
if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
|
||||
}
|
||||
}
|
||||
// cout << "allHighestSet " << allHighestSet << endl;
|
||||
|
||||
// cout << "firstflopround " << firstTurnRound << endl;
|
||||
|
||||
// prfen, ob Turn wirklich dran ist
|
||||
if(!firstTurnRound && allHighestSet) {
|
||||
|
||||
// Turn nicht dran, weil alle Sets gleich sind
|
||||
//also gehe in Turn
|
||||
myHand->setActualRound(3);
|
||||
|
||||
//Action l�chen und ActionButtons refresh
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if(myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0);
|
||||
}
|
||||
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
|
||||
myHand->getBoard()->collectSets();
|
||||
myHand->getBoard()->collectPot();
|
||||
myHand->getGuiInterface()->refreshPot();
|
||||
|
||||
myHand->getGuiInterface()->refreshSet();
|
||||
myHand->getGuiInterface()->refreshCash();
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { myHand->getGuiInterface()->refreshAction(i,0); }
|
||||
|
||||
myHand->switchRounds();
|
||||
}
|
||||
else {
|
||||
// Turn ist wirklich dran
|
||||
|
||||
// Anzahl der effektiv gespielten Runden (des human player) erhöhen
|
||||
if(myHand->getPlayerArray()[0]->getMyActiveStatus() && myHand->getPlayerArray()[0]->getMyAction() != 1) {
|
||||
myHand->setBettingRoundsPlayed(2);
|
||||
}
|
||||
|
||||
if( !(myHand->getActualQuantityPlayers() < 3 && firstHeadsUpTurnRound == 1) ) {
|
||||
// not first round in heads up (for headsup dealer is smallblind so it is dealers turn)
|
||||
|
||||
// naechsten Spieler ermitteln
|
||||
do { playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||
} while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6);
|
||||
}
|
||||
else { firstHeadsUpTurnRound = 0; }
|
||||
|
||||
//Spieler-Position vor SmallBlind-Position ermitteln
|
||||
int activePlayerBeforeSmallBlind = smallBlindPosition;
|
||||
do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS);
|
||||
} while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6);
|
||||
|
||||
myHand->getPlayerArray()[playersTurn]->setMyTurn(1);
|
||||
//highlight active players groupbox and clear action
|
||||
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
||||
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
||||
|
||||
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
|
||||
// cout << "playersTurn " << playersTurn << endl;
|
||||
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
||||
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstTurnRound = 0; }
|
||||
|
||||
if(playersTurn == 0) {
|
||||
// Wir sind dran
|
||||
// cout << "actualRound " << myHand->getActualRound() << endl;
|
||||
// cout << "highestSet vor meInAction " << highestSet << endl;
|
||||
myHand->getGuiInterface()->meInAction();
|
||||
}
|
||||
else {
|
||||
//Gegner sind dran
|
||||
// cout << "NextPlayerSpeed3 start" << endl;
|
||||
myHand->getGuiInterface()->turnAnimation2();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LocalBeRoTurn::nextPlayer2() {
|
||||
// cout << "NextPlayerSpeed3 stop" << endl;
|
||||
myHand->getPlayerArray()[playersTurn]->action();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@web.de *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef LOCALBEROTURN_H
|
||||
#define LOCALBEROTURN_H
|
||||
|
||||
#include <localbero.h>
|
||||
#include <iostream>
|
||||
|
||||
class HandInterface;
|
||||
|
||||
class LocalBeRoTurn : public LocalBeRo{
|
||||
public:
|
||||
LocalBeRoTurn(HandInterface*, int, int, int, int);
|
||||
~LocalBeRoTurn();
|
||||
|
||||
void setPlayersTurn(int theValue) { playersTurn = theValue; }
|
||||
int getPlayersTurn() const { return playersTurn; }
|
||||
|
||||
void setHighestSet(int theValue) { highestSet = theValue; }
|
||||
int getHighestSet() const { return highestSet;}
|
||||
|
||||
void setFirstTurnRound(bool theValue) { firstTurnRound = theValue;}
|
||||
bool getFirstTurnRound() const { return firstTurnRound;}
|
||||
|
||||
void setSmallBlindPosition(int theValue) { smallBlindPosition = theValue;}
|
||||
int getSmallBlindPosition() const { return smallBlindPosition; }
|
||||
|
||||
void setSmallBlind(int theValue) { smallBlind = theValue; }
|
||||
int getSmallBlind() const { return smallBlind; }
|
||||
|
||||
void resetFirstRun() { firstTurnRun = false; }
|
||||
|
||||
void nextPlayer2();
|
||||
void turnRun();
|
||||
|
||||
//only until bero refactory is over
|
||||
void preflopRun() {}
|
||||
void flopRun() {}
|
||||
void riverRun() {}
|
||||
void postRiverRun() {}
|
||||
|
||||
private:
|
||||
|
||||
HandInterface *myHand;
|
||||
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
int dealerPosition;
|
||||
int smallBlindPosition;
|
||||
|
||||
int smallBlind;
|
||||
int highestSet;
|
||||
|
||||
bool firstTurnRun;
|
||||
bool firstTurnRound;
|
||||
bool firstHeadsUpTurnRound;
|
||||
int playersTurn;
|
||||
|
||||
bool logBoardCardsDone;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -173,7 +173,10 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
||||
myRiver = myFactory->createRiver(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
|
||||
|
||||
myBeRoFactory = myFactory->createBeRoFactory(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
|
||||
myBeRo = myBeRoFactory->switchRounds();
|
||||
|
||||
int currentRound = actualRound; // for Lothar ;-)
|
||||
|
||||
myBeRo = myBeRoFactory->switchRounds(currentRound);
|
||||
}
|
||||
|
||||
|
||||
@@ -378,6 +381,8 @@ void LocalHand::switchRounds() {
|
||||
myGui->refreshGameLabels((GameState)getActualRound());
|
||||
// /*/*/*/*cout <<*/*/*/*/ "NextPlayerSpeed1 stop" << endl;
|
||||
//
|
||||
|
||||
|
||||
// cout << "NextPlayerSpeed2 start" << endl;
|
||||
switch(actualRound) {
|
||||
case 0: {
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
TurnInterface* getTurn() const { return myTurn; }
|
||||
RiverInterface* getRiver() const { return myRiver; }
|
||||
GuiInterface* getGuiInterface() const { return myGui; }
|
||||
BeRoInterface* getCurrentBeRo() const { return myBeRo; }
|
||||
|
||||
void setMyID(int theValue) { myID = theValue; }
|
||||
int getMyID() const { return myID; }
|
||||
|
||||
@@ -22,11 +22,12 @@
|
||||
#include <handinterface.h>
|
||||
#include <game_defs.h>
|
||||
|
||||
//using namespace std;
|
||||
using namespace std;
|
||||
|
||||
LocalPreflop::LocalPreflop(HandInterface* bR, int id, int qP, int dP, int sB) : PreflopInterface(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), bigBlindPosition(0), smallBlind(sB), highestSet(2*sB), preflopFirstRound(1), playersTurn(0)
|
||||
|
||||
{
|
||||
cout << "OLD PREFLOP INIT!!!" << endl;
|
||||
// // BigBlind ermitteln
|
||||
bigBlindPosition = dealerPosition;
|
||||
while (myHand->getPlayerArray()[bigBlindPosition]->getMyButton() != 3) {
|
||||
@@ -48,7 +49,7 @@ LocalPreflop::~LocalPreflop()
|
||||
|
||||
void LocalPreflop::preflopRun() {
|
||||
|
||||
// cout << "NextPlayerSpeed2 stop" << endl;
|
||||
cout << "OLD PREFLOPRUN" << endl;
|
||||
int i;
|
||||
bool allHighestSet = 1;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define LOCALPREFLOP_H
|
||||
|
||||
#include <preflopinterface.h>
|
||||
#include <iostream>
|
||||
|
||||
class HandInterface;
|
||||
|
||||
@@ -37,9 +38,6 @@ public:
|
||||
void setHighestSet(int theValue) { highestSet = theValue; }
|
||||
int getHighestSet() const { return highestSet;}
|
||||
|
||||
void setPreflopFirstRound(bool theValue) { preflopFirstRound = theValue; }
|
||||
bool setPreflopFirstRound() const { return preflopFirstRound; }
|
||||
|
||||
void preflopRun();
|
||||
void nextPlayer2();
|
||||
|
||||
|
||||
@@ -24,6 +24,12 @@ public:
|
||||
|
||||
~ClientBeRo();
|
||||
|
||||
int getMyBeRoID() const { return myBeRoID; }
|
||||
|
||||
protected:
|
||||
|
||||
int myBeRoID;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,4 +22,4 @@ ClientBeRoFactory::~ClientBeRoFactory()
|
||||
}
|
||||
|
||||
|
||||
BeRoInterface* ClientBeRoFactory::switchRounds() { return NULL;}
|
||||
BeRoInterface* ClientBeRoFactory::switchRounds(int currentRound) { return NULL;}
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
|
||||
~ClientBeRoFactory();
|
||||
|
||||
BeRoInterface* switchRounds();
|
||||
BeRoInterface* switchRounds(int);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -108,6 +108,13 @@ ClientHand::getRiver() const
|
||||
return myRiver;
|
||||
}
|
||||
|
||||
BeRoInterface*
|
||||
ClientHand::getCurrentBeRo() const
|
||||
{
|
||||
return myBeRo;
|
||||
}
|
||||
|
||||
|
||||
GuiInterface*
|
||||
ClientHand::getGuiInterface() const
|
||||
{
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
TurnInterface* getTurn() const;
|
||||
RiverInterface* getRiver() const;
|
||||
GuiInterface* getGuiInterface() const;
|
||||
BeRoInterface* getCurrentBeRo() const;
|
||||
|
||||
void setMyID(int theValue);
|
||||
int getMyID() const;
|
||||
|
||||
@@ -62,20 +62,6 @@ ClientPreflop::getHighestSet() const
|
||||
return highestSet;
|
||||
}
|
||||
|
||||
void
|
||||
ClientPreflop::setPreflopFirstRound(bool theValue)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||
preflopFirstRound = theValue;
|
||||
}
|
||||
|
||||
bool
|
||||
ClientPreflop::setPreflopFirstRound() const
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||
return preflopFirstRound;
|
||||
}
|
||||
|
||||
void
|
||||
ClientPreflop::preflopRun()
|
||||
{
|
||||
|
||||
@@ -36,9 +36,6 @@ public:
|
||||
void setHighestSet(int theValue);
|
||||
int getHighestSet() const;
|
||||
|
||||
void setPreflopFirstRound(bool theValue);
|
||||
bool setPreflopFirstRound() const;
|
||||
|
||||
void preflopRun();
|
||||
void nextPlayer2();
|
||||
|
||||
|
||||
@@ -31,9 +31,6 @@ public:
|
||||
virtual void setHighestSet(int theValue) =0;
|
||||
virtual int getHighestSet() const =0;
|
||||
|
||||
virtual void setPreflopFirstRound(bool theValue) =0;
|
||||
virtual bool setPreflopFirstRound() const =0;
|
||||
|
||||
virtual void preflopRun() =0;
|
||||
virtual void nextPlayer2() =0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user