BeRo refactoring
This commit is contained in:
+4
-20
@@ -71,12 +71,8 @@ HEADERS += src/game.h \
|
||||
src/core/thread.h \
|
||||
src/engine/boardinterface.h \
|
||||
src/engine/enginefactory.h \
|
||||
src/engine/flopinterface.h \
|
||||
src/engine/handinterface.h \
|
||||
src/engine/playerinterface.h \
|
||||
src/engine/preflopinterface.h \
|
||||
src/engine/riverinterface.h \
|
||||
src/engine/turninterface.h \
|
||||
src/engine/berointerface.h \
|
||||
src/gui/guiinterface.h \
|
||||
src/net/clientcallback.h \
|
||||
@@ -97,17 +93,13 @@ HEADERS += src/game.h \
|
||||
src/engine/local_engine/cardsvalue.h \
|
||||
src/engine/local_engine/localboard.h \
|
||||
src/engine/local_engine/localenginefactory.h \
|
||||
src/engine/local_engine/localflop.h \
|
||||
src/engine/local_engine/localberoflop.h \
|
||||
src/engine/local_engine/localhand.h \
|
||||
src/engine/local_engine/localplayer.h \
|
||||
src/engine/local_engine/localpreflop.h \
|
||||
src/engine/local_engine/localberopreflop.h \
|
||||
src/engine/local_engine/localriver.h \
|
||||
src/engine/local_engine/localberoflop.h \
|
||||
src/engine/local_engine/localberoturn.h \
|
||||
src/engine/local_engine/localberoriver.h \
|
||||
src/engine/local_engine/localberopostriver.h \
|
||||
src/engine/local_engine/localturn.h \
|
||||
src/engine/local_engine/localberoturn.h \
|
||||
src/engine/local_engine/tools.h \
|
||||
src/engine/local_engine/localbero.h \
|
||||
src/engine/network_engine/clientboard.h \
|
||||
@@ -162,12 +154,8 @@ SOURCES += src/game.cpp \
|
||||
src/config/configfile.cpp \
|
||||
src/engine/boardinterface.cpp \
|
||||
src/engine/enginefactory.cpp \
|
||||
src/engine/flopinterface.cpp \
|
||||
src/engine/handinterface.cpp \
|
||||
src/engine/playerinterface.cpp \
|
||||
src/engine/preflopinterface.cpp \
|
||||
src/engine/riverinterface.cpp \
|
||||
src/engine/turninterface.cpp \
|
||||
src/engine/berointerface.cpp \
|
||||
src/gui/guiinterface.cpp \
|
||||
src/core/common/thread.cpp \
|
||||
@@ -178,17 +166,13 @@ SOURCES += src/game.cpp \
|
||||
src/engine/local_engine/cardsvalue.cpp \
|
||||
src/engine/local_engine/localboard.cpp \
|
||||
src/engine/local_engine/localenginefactory.cpp \
|
||||
src/engine/local_engine/localflop.cpp \
|
||||
src/engine/local_engine/localberoflop.cpp \
|
||||
src/engine/local_engine/localhand.cpp \
|
||||
src/engine/local_engine/localplayer.cpp \
|
||||
src/engine/local_engine/localpreflop.cpp \
|
||||
src/engine/local_engine/localberopreflop.cpp \
|
||||
src/engine/local_engine/localriver.cpp \
|
||||
src/engine/local_engine/localberoflop.cpp \
|
||||
src/engine/local_engine/localberoturn.cpp \
|
||||
src/engine/local_engine/localberoriver.cpp \
|
||||
src/engine/local_engine/localberopostriver.cpp \
|
||||
src/engine/local_engine/localturn.cpp \
|
||||
src/engine/local_engine/localberoturn.cpp \
|
||||
src/engine/local_engine/tools.cpp \
|
||||
src/engine/local_engine/localbero.cpp \
|
||||
src/engine/network_engine/clientboard.cpp \
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
|
||||
virtual void run() =0;
|
||||
|
||||
// for network
|
||||
// temporary for network
|
||||
virtual void preflopRun() =0;
|
||||
virtual void flopRun() =0;
|
||||
virtual void turnRun() =0;
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 "flopinterface.h"
|
||||
|
||||
FlopInterface::~FlopInterface()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 FLOPINTERFACE_H
|
||||
#define FLOPINTERFACE_H
|
||||
|
||||
class FlopInterface{
|
||||
public:
|
||||
|
||||
|
||||
virtual ~FlopInterface();
|
||||
|
||||
virtual void setPlayersTurn(int theValue) =0;
|
||||
virtual int getPlayersTurn() const =0;
|
||||
|
||||
virtual void setHighestSet(int theValue) =0;
|
||||
virtual int getHighestSet() const =0;
|
||||
|
||||
virtual void setFirstFlopRound(bool theValue) =0;
|
||||
virtual bool getFirstFlopRound() const =0;
|
||||
|
||||
virtual void setSmallBlindPosition(int theValue) =0;
|
||||
virtual int getSmallBlindPosition() const =0;
|
||||
|
||||
virtual void setSmallBlind(int theValue) =0;
|
||||
virtual int getSmallBlind() const =0;
|
||||
|
||||
virtual void resetFirstRun() =0;
|
||||
|
||||
virtual void flopRun() =0;
|
||||
virtual void nextPlayer2() =0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -27,10 +27,6 @@
|
||||
#include "guiinterface.h"
|
||||
#include "boardinterface.h"
|
||||
#include "playerinterface.h"
|
||||
#include "preflopinterface.h"
|
||||
#include "flopinterface.h"
|
||||
#include "turninterface.h"
|
||||
#include "riverinterface.h"
|
||||
#include "berointerface.h"
|
||||
|
||||
class HandInterface{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
#include "localbero.h"
|
||||
|
||||
LocalBeRo::LocalBeRo() : BeRoInterface()
|
||||
LocalBeRo::LocalBeRo(HandInterface* hi, int id, int qP, int dP, int sB) : BeRoInterface(), myHand(hi), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRun(1), firstRound(1), firstHeadsUpRound(1), playersTurn(dP), logBoardCardsDone(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -20,4 +20,100 @@ LocalBeRo::~LocalBeRo()
|
||||
{
|
||||
}
|
||||
|
||||
void LocalBeRo::run() {
|
||||
|
||||
int i;
|
||||
|
||||
if (firstRun) {
|
||||
|
||||
myHand->getGuiInterface()->dealBeRoCards(myBeRoID);
|
||||
firstRun = 0;
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
//log the turned cards
|
||||
if(!logBoardCardsDone) {
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
|
||||
myHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, 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; }
|
||||
}
|
||||
}
|
||||
|
||||
// prfen, ob Flop wirklich dran ist
|
||||
if(!firstRound && allHighestSet) {
|
||||
|
||||
// Flop nicht dran, weil alle Sets gleich sind
|
||||
//also gehe in Turn
|
||||
myHand->setActualRound(myBeRoID+1);
|
||||
|
||||
//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(myBeRoID);
|
||||
}
|
||||
|
||||
if( !(myHand->getActualQuantityPlayers() < 3 && firstHeadsUpRound == 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 { firstHeadsUpRound = 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);
|
||||
|
||||
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
||||
if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind) { firstRound = 0; }
|
||||
|
||||
if(playersTurn == 0) {
|
||||
// Wir sind dran
|
||||
myHand->getGuiInterface()->meInAction();
|
||||
}
|
||||
else {
|
||||
//Gegner sind dran
|
||||
myHand->getGuiInterface()->flopAnimation2();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,13 +13,14 @@
|
||||
#define LOCALBERO_H
|
||||
|
||||
#include "berointerface.h"
|
||||
#include "handinterface.h"
|
||||
|
||||
/**
|
||||
@author FThauer FHammer <webmaster@pokerth.net>
|
||||
*/
|
||||
class LocalBeRo : public BeRoInterface{
|
||||
public:
|
||||
LocalBeRo();
|
||||
LocalBeRo(HandInterface* hi, int id, int qP, int dP, int sB);
|
||||
|
||||
~LocalBeRo();
|
||||
|
||||
@@ -28,7 +29,8 @@ public:
|
||||
int getHighestCardsValue() const {return 0;}
|
||||
void setHighestCardsValue(int theValue) {}
|
||||
|
||||
void run() {}
|
||||
void run();
|
||||
|
||||
//only until bero refactoring is over
|
||||
void preflopRun() {}
|
||||
void flopRun() {}
|
||||
@@ -40,7 +42,24 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
HandInterface* myHand;
|
||||
|
||||
int myBeRoID;
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
int dealerPosition;
|
||||
int smallBlindPosition;
|
||||
|
||||
int smallBlind;
|
||||
int highestSet;
|
||||
|
||||
bool firstRun;
|
||||
bool firstRound;
|
||||
bool firstHeadsUpRound;
|
||||
int playersTurn;
|
||||
|
||||
bool logBoardCardsDone;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
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)
|
||||
LocalBeRoFlop::LocalBeRoFlop(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB), myHand(hi), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstFlopRun(1), firstFlopRound(1), firstHeadsUpFlopRound(1), playersTurn(dP), logBoardCardsDone(0)
|
||||
|
||||
{
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
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)
|
||||
LocalBeRoPostRiver::LocalBeRoPostRiver(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB), myHand(hi), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRiverRun(1), firstRiverRound(1), firstHeadsUpRiverRound(1), playersTurn(dP), highestCardsValue(0), logBoardCardsDone(0)
|
||||
|
||||
{
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
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)
|
||||
LocalBeRoPreflop::LocalBeRoPreflop(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB), myHand(hi), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), bigBlindPosition(0), smallBlind(sB), highestSet(2*sB), preflopFirstRound(1), playersTurn(0)
|
||||
|
||||
{
|
||||
myBeRoID = GAME_STATE_PREFLOP;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
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)
|
||||
LocalBeRoRiver::LocalBeRoRiver(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB), myHand(hi), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRiverRun(1), firstRiverRound(1), firstHeadsUpRiverRound(1), playersTurn(dP), highestCardsValue(0), logBoardCardsDone(0)
|
||||
|
||||
{
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
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)
|
||||
LocalBeRoTurn::LocalBeRoTurn(HandInterface* hi, int id, int qP, int dP, int sB) : LocalBeRo(hi, id, qP, dP, sB), myHand(hi), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstTurnRun(1), firstTurnRound(1), firstHeadsUpTurnRound(1), playersTurn(dP), logBoardCardsDone(0)
|
||||
|
||||
{
|
||||
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 "localflop.h"
|
||||
#include <game_defs.h>
|
||||
#include <handinterface.h>
|
||||
|
||||
//using namespace std;
|
||||
|
||||
LocalFlop::LocalFlop(HandInterface* bR, int id, int qP, int dP, int sB) : FlopInterface(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstFlopRun(1), firstFlopRound(1), firstHeadsUpFlopRound(1), playersTurn(dP), logBoardCardsDone(0)
|
||||
|
||||
{
|
||||
int i;
|
||||
|
||||
//SmallBlind-Position ermitteln
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if (myHand->getPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
LocalFlop::~LocalFlop()
|
||||
{
|
||||
}
|
||||
|
||||
void LocalFlop::flopRun() {
|
||||
|
||||
// cout << "NextPlayerSpeed2 stop" << 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 LocalFlop::nextPlayer2() {
|
||||
|
||||
// cout << "NextPlayerSpeed3 stop" << endl;
|
||||
myHand->getPlayerArray()[playersTurn]->action();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 LOCALFLOP_H
|
||||
#define LOCALFLOP_H
|
||||
|
||||
#include <flopinterface.h>
|
||||
|
||||
class HandInterface;
|
||||
|
||||
class LocalFlop : public FlopInterface{
|
||||
|
||||
public:
|
||||
LocalFlop(HandInterface*, int, int, int, int);
|
||||
~LocalFlop();
|
||||
|
||||
|
||||
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();
|
||||
|
||||
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
|
||||
@@ -1,124 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2006 by FThauer FHammer *
|
||||
* f.thauer@web.de *Irische Segenswnsche,
|
||||
* *
|
||||
* 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 "localpreflop.h"
|
||||
|
||||
#include <handinterface.h>
|
||||
#include <game_defs.h>
|
||||
|
||||
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) {
|
||||
bigBlindPosition = (bigBlindPosition+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||
}
|
||||
|
||||
// // erste Spielernummer fr preflopRun() setzen
|
||||
playersTurn = bigBlindPosition;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LocalPreflop::~LocalPreflop()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void LocalPreflop::preflopRun() {
|
||||
|
||||
cout << "OLD PREFLOPRUN" << endl;
|
||||
int i;
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
||||
// BigBlind ermitteln
|
||||
bigBlindPosition = dealerPosition;
|
||||
while (myHand->getPlayerArray()[bigBlindPosition]->getMyButton() != 3) {
|
||||
bigBlindPosition = (bigBlindPosition+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||
}
|
||||
|
||||
// prfen, ob Preflop wirklich dran ist
|
||||
if(!preflopFirstRound && allHighestSet) {
|
||||
|
||||
// Preflop nicht dran, weil wir nicht mehr in erster PreflopRunde und alle Sets gleich sind
|
||||
//also gehe in Flop
|
||||
myHand->setActualRound(1);
|
||||
|
||||
//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 {
|
||||
// Preflop ist wirklich dran
|
||||
|
||||
// naechsten Spieler ermitteln
|
||||
do {
|
||||
|
||||
playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||
// falls BigBlind, dann PreflopFirstRound zuende
|
||||
if(myHand->getPlayerArray()[playersTurn]->getMyButton() == 3) preflopFirstRound = 0;
|
||||
|
||||
} while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || myHand->getPlayerArray()[playersTurn]->getMyAction() == 1 || myHand->getPlayerArray()[playersTurn]->getMyAction() == 6);
|
||||
|
||||
myHand->getPlayerArray()[playersTurn]->setMyTurn(1);
|
||||
//highlight active players groupbox and clear action
|
||||
myHand->getGuiInterface()->refreshGroupbox(playersTurn,2);
|
||||
myHand->getGuiInterface()->refreshAction(playersTurn,0);
|
||||
|
||||
if(playersTurn == 0) {
|
||||
// Wir sind dran
|
||||
myHand->getGuiInterface()->meInAction();
|
||||
}
|
||||
else {
|
||||
//Gegner sind dran
|
||||
// cout << "NextPlayerSpeed3 start" << endl;
|
||||
myHand->getGuiInterface()->preflopAnimation2();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LocalPreflop::nextPlayer2() {
|
||||
// cout << "NextPlayerSpeed3 stop" << endl;
|
||||
myHand->getPlayerArray()[playersTurn]->action();
|
||||
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 LOCALPREFLOP_H
|
||||
#define LOCALPREFLOP_H
|
||||
|
||||
#include <preflopinterface.h>
|
||||
#include <iostream>
|
||||
|
||||
class HandInterface;
|
||||
|
||||
class LocalPreflop : public PreflopInterface{
|
||||
|
||||
public:
|
||||
LocalPreflop(HandInterface*, int, int, int, int);
|
||||
~LocalPreflop();
|
||||
|
||||
|
||||
void setPlayersTurn(int theValue) { playersTurn = theValue; }
|
||||
int getPlayersTurn() const { return playersTurn; }
|
||||
|
||||
void setHighestSet(int theValue) { highestSet = theValue; }
|
||||
int getHighestSet() const { return highestSet;}
|
||||
|
||||
void preflopRun();
|
||||
void nextPlayer2();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
HandInterface *myHand;
|
||||
|
||||
int myID;
|
||||
int actualQuantityPlayers;
|
||||
int dealerPosition;
|
||||
int bigBlindPosition;
|
||||
|
||||
int smallBlind;
|
||||
int highestSet;
|
||||
|
||||
bool preflopFirstRound;
|
||||
int playersTurn;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,473 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 "localriver.h"
|
||||
#include <handinterface.h>
|
||||
#include <game_defs.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
LocalRiver::LocalRiver(HandInterface* bR, int id, int qP, int dP, int sB) : RiverInterface(), 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)
|
||||
|
||||
{ int i;
|
||||
|
||||
//SmallBlind-Position ermitteln
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if (myHand->getPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LocalRiver::~LocalRiver()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void LocalRiver::riverRun() {
|
||||
|
||||
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 LocalRiver::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 LocalRiver::nextPlayer2() {
|
||||
|
||||
myHand->getPlayerArray()[playersTurn]->action();
|
||||
|
||||
}
|
||||
|
||||
void LocalRiver::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;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 LOCALRIVER_H
|
||||
#define LOCALRIVER_H
|
||||
|
||||
#include <riverinterface.h>
|
||||
|
||||
class HandInterface;
|
||||
|
||||
|
||||
class LocalRiver : public RiverInterface{
|
||||
public:
|
||||
LocalRiver(HandInterface*, int, int, int, int);
|
||||
~LocalRiver();
|
||||
|
||||
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();
|
||||
|
||||
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
|
||||
@@ -1,152 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 "localturn.h"
|
||||
#include <handinterface.h>
|
||||
#include <game_defs.h>
|
||||
|
||||
|
||||
//using namespace std;
|
||||
|
||||
LocalTurn::LocalTurn(HandInterface* bR, int id, int qP, int dP, int sB) : TurnInterface(), myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstTurnRun(1), firstTurnRound(1), firstHeadsUpTurnRound(1), playersTurn(dP), logBoardCardsDone(0)
|
||||
|
||||
{ int i;
|
||||
|
||||
//SmallBlind-Position ermitteln
|
||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
if (myHand->getPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LocalTurn::~LocalTurn()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void LocalTurn::turnRun() {
|
||||
|
||||
// cout << "NextPlayerSpeed2 stop" << 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 LocalTurn::nextPlayer2() {
|
||||
// cout << "NextPlayerSpeed3 stop" << endl;
|
||||
myHand->getPlayerArray()[playersTurn]->action();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 LOCALTURN_H
|
||||
#define LOCALTURN_H
|
||||
|
||||
#include <turninterface.h>
|
||||
|
||||
class HandInterface;
|
||||
|
||||
class LocalTurn : public TurnInterface{
|
||||
public:
|
||||
LocalTurn(HandInterface*, int, int, int, int);
|
||||
~LocalTurn();
|
||||
|
||||
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 turnRun();
|
||||
void nextPlayer2();
|
||||
|
||||
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
|
||||
@@ -22,8 +22,7 @@
|
||||
using namespace std;
|
||||
|
||||
ClientHand::ClientHand(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), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0),
|
||||
myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0),
|
||||
: myFactory(f), 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),
|
||||
cardsShown(false), bettingRoundsPlayed(0)
|
||||
{
|
||||
|
||||
@@ -24,12 +24,7 @@
|
||||
#include <boardinterface.h>
|
||||
#include <playerinterface.h>
|
||||
#include <handinterface.h>
|
||||
#include <preflopinterface.h>
|
||||
#include <flopinterface.h>
|
||||
#include <turninterface.h>
|
||||
#include <riverinterface.h>
|
||||
#include <berointerface.h>
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
#include <vector>
|
||||
@@ -97,11 +92,6 @@ class ClientHand : public HandInterface
|
||||
GuiInterface *myGui;
|
||||
BoardInterface *myBoard;
|
||||
PlayerInterface **playerArray;
|
||||
PreflopInterface *myPreflop;
|
||||
FlopInterface *myFlop;
|
||||
TurnInterface *myTurn;
|
||||
RiverInterface *myRiver;
|
||||
BeRoInterface *myOldBeRo;
|
||||
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
|
||||
|
||||
int myID;
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 "preflopinterface.h"
|
||||
|
||||
PreflopInterface::~PreflopInterface()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 PREFLOPINTERFACE_H
|
||||
#define PREFLOPINTERFACE_H
|
||||
|
||||
class PreflopInterface{
|
||||
public:
|
||||
|
||||
virtual ~PreflopInterface();
|
||||
|
||||
virtual void setPlayersTurn(int theValue) =0;
|
||||
virtual int getPlayersTurn() const =0;
|
||||
|
||||
virtual void setHighestSet(int theValue) =0;
|
||||
virtual int getHighestSet() const =0;
|
||||
|
||||
virtual void preflopRun() =0;
|
||||
virtual void nextPlayer2() =0;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,26 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 "riverinterface.h"
|
||||
|
||||
RiverInterface::~RiverInterface()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 RIVERINTERFACE_H
|
||||
#define RIVERINTERFACE_H
|
||||
|
||||
class RiverInterface{
|
||||
public:
|
||||
|
||||
virtual ~RiverInterface();
|
||||
|
||||
virtual void setPlayersTurn(int theValue) =0;
|
||||
virtual int getPlayersTurn() const =0;
|
||||
|
||||
virtual void setHighestSet(int theValue) =0;
|
||||
virtual int getHighestSet() const =0;
|
||||
|
||||
virtual void setFirstRiverRound(bool theValue) =0;
|
||||
virtual bool getFirstRiverRound() const =0;
|
||||
|
||||
virtual void setSmallBlindPosition(int theValue) =0;
|
||||
virtual int getSmallBlindPosition() const =0;
|
||||
|
||||
virtual void setSmallBlind(int theValue) =0;
|
||||
virtual int getSmallBlind() const =0;
|
||||
|
||||
virtual void setHighestCardsValue(int theValue) =0;
|
||||
virtual int getHighestCardsValue() const =0;
|
||||
|
||||
virtual void resetFirstRun() =0;
|
||||
|
||||
virtual void riverRun() =0;
|
||||
virtual void postRiverRun() =0;
|
||||
virtual void nextPlayer2() =0;
|
||||
virtual void distributePot() =0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,26 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 "turninterface.h"
|
||||
|
||||
TurnInterface::~TurnInterface()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ void ServerGuiWrapper::refreshGameLabels(GameState state) const {}
|
||||
|
||||
void ServerGuiWrapper::waitForGuiUpdateDone() const {}
|
||||
|
||||
void ServerGuiWrapper::dealBeRoCards(int myBeRoID) {}
|
||||
void ServerGuiWrapper::dealHoleCards() {}
|
||||
void ServerGuiWrapper::dealFlopCards() {}
|
||||
void ServerGuiWrapper::dealTurnCard() {}
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
|
||||
void waitForGuiUpdateDone() const;
|
||||
|
||||
void dealBeRoCards(int);
|
||||
void dealHoleCards();
|
||||
void dealFlopCards();
|
||||
void dealTurnCard();
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
|
||||
virtual void waitForGuiUpdateDone() const=0;
|
||||
|
||||
virtual void dealBeRoCards(int) =0;
|
||||
// // Karten-Funktionen
|
||||
virtual void dealHoleCards()=0;
|
||||
virtual void dealFlopCards()=0;
|
||||
|
||||
@@ -66,6 +66,8 @@ void GuiWrapper::waitForGuiUpdateDone() const
|
||||
myW->waitForGuiUpdateDone();
|
||||
}
|
||||
|
||||
void GuiWrapper::dealBeRoCards(int myBeRoID) { myW->signalDealBeRoCards(myBeRoID); }
|
||||
|
||||
void GuiWrapper::dealHoleCards() { myW->signalDealHoleCards(); }
|
||||
void GuiWrapper::dealFlopCards() { myW->signalDealFlopCards0(); }
|
||||
void GuiWrapper::dealTurnCard() { myW->signalDealTurnCards0(); }
|
||||
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
|
||||
void waitForGuiUpdateDone() const;
|
||||
|
||||
void dealBeRoCards(int myBeRoID);
|
||||
void dealHoleCards();
|
||||
void dealFlopCards();
|
||||
void dealTurnCard();
|
||||
|
||||
@@ -605,6 +605,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
||||
connect(this, SIGNAL(signalStartTimeoutAnimation(int, int)), this, SLOT(startTimeoutAnimation(int, int)));
|
||||
connect(this, SIGNAL(signalStopTimeoutAnimation(int)), this, SLOT(stopTimeoutAnimation(int)));
|
||||
|
||||
connect(this, SIGNAL(signalDealBeRoCards(int)), this, SLOT(dealBeRoCards(int)));
|
||||
connect(this, SIGNAL(signalDealHoleCards()), this, SLOT(dealHoleCards()));
|
||||
connect(this, SIGNAL(signalDealFlopCards0()), this, SLOT(dealFlopCards0()));
|
||||
connect(this, SIGNAL(signalDealTurnCards0()), this, SLOT(dealTurnCards0()));
|
||||
@@ -1307,6 +1308,21 @@ void mainWindowImpl::dealHoleCards() {
|
||||
}
|
||||
}
|
||||
|
||||
void mainWindowImpl::dealBeRoCards(int myBeRoID) {
|
||||
|
||||
switch(myBeRoID) {
|
||||
|
||||
case 1: { dealFlopCards0(); }
|
||||
break;
|
||||
case 2: { dealTurnCards0(); }
|
||||
break;
|
||||
case 3: { dealRiverCards0(); }
|
||||
break;
|
||||
default: { cout << "dealBeRoCards Error" << endl; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mainWindowImpl::dealFlopCards0() { dealFlopCards0Timer->start(preDealCardsSpeed); }
|
||||
|
||||
void mainWindowImpl::dealFlopCards1() {
|
||||
|
||||
@@ -95,6 +95,8 @@ signals:
|
||||
void signalStartTimeoutAnimation(int playerId, int timeoutSec);
|
||||
void signalStopTimeoutAnimation(int playerId);
|
||||
|
||||
void signalDealBeRoCards(int myBeRoID);
|
||||
|
||||
void signalDealHoleCards();
|
||||
void signalDealFlopCards0();
|
||||
void signalDealTurnCards0();
|
||||
@@ -179,6 +181,8 @@ public slots:
|
||||
|
||||
void myActionDone();
|
||||
|
||||
void dealBeRoCards(int);
|
||||
|
||||
void dealFlopCards0();
|
||||
void dealFlopCards1();
|
||||
void dealFlopCards2();
|
||||
|
||||
Reference in New Issue
Block a user