std::vector<boost::shared_ptr<BeRoInterface> > implemented

This commit is contained in:
doitux
2007-08-06 20:35:26 +00:00
parent 562e8760f5
commit 96419b3588
22 changed files with 172 additions and 139 deletions
+2 -1
View File
@@ -28,7 +28,8 @@ public:
int getHighestCardsValue() const {}
void setHighestCardsValue(int theValue) {}
//only until bero refactory is over
void run() {}
//only until bero refactoring is over
void preflopRun() {}
void flopRun() {}
void riverRun() {}
@@ -21,6 +21,24 @@ LocalBeRoFactory::LocalBeRoFactory (HandInterface* hi, int id, int aP, int dP, i
LocalBeRoFactory::~LocalBeRoFactory()
{}
std::vector<boost::shared_ptr<BeRoInterface> > LocalBeRoFactory::createBeRo() {
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoPreflop(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoFlop(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoTurn(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoRiver(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoPostRiver(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
return myBeRo;
}
BeRoInterface* LocalBeRoFactory::createBeRoPreflop() {
BeRoInterface* preflopBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
@@ -14,6 +14,10 @@
#include <istream>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <berofactoryinterface.h>
#include <berointerface.h>
#include <handinterface.h>
@@ -37,6 +41,9 @@ public:
BeRoInterface* createBeRoPreflop();
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo();
private:
HandInterface* myHand;
+1 -1
View File
@@ -45,7 +45,7 @@ LocalBeRoFlop::~LocalBeRoFlop()
{
}
void LocalBeRoFlop::flopRun() {
void LocalBeRoFlop::run() {
cout << "LocalBeroFlopRun!!!" << endl;
+2 -1
View File
@@ -49,7 +49,8 @@ public:
void resetFirstRun() { firstFlopRun = false; }
void flopRun();
void run();
void nextPlayer2();
private:
+1 -1
View File
@@ -50,7 +50,7 @@ LocalBeRoPreflop::~LocalBeRoPreflop()
}
void LocalBeRoPreflop::preflopRun() {
void LocalBeRoPreflop::run() {
cout << "LocalBeroPreflopRun!!!" << endl;
+1 -1
View File
@@ -37,7 +37,7 @@ public:
void setHighestSet(int theValue) { highestSet = theValue; }
int getHighestSet() const { return highestSet;}
void preflopRun();
void run();
void nextPlayer2();
+1 -1
View File
@@ -45,7 +45,7 @@ LocalBeRoRiver::~LocalBeRoRiver()
}
void LocalBeRoRiver::riverRun() {
void LocalBeRoRiver::run() {
cout << "LocalBeroRiverRun!!!" << endl;
int i;
+1 -1
View File
@@ -51,7 +51,7 @@ public:
void resetFirstRun() { firstRiverRun = false; }
void riverRun();
void run();
void postRiverRun();
void nextPlayer2();
void distributePot();
+1 -1
View File
@@ -46,7 +46,7 @@ LocalBeRoTurn::~LocalBeRoTurn()
}
void LocalBeRoTurn::turnRun() {
void LocalBeRoTurn::run() {
cout << "LocalBeroTurnRun!!!" << endl;
int i;
+1 -1
View File
@@ -48,7 +48,7 @@ public:
void resetFirstRun() { firstTurnRun = false; }
void nextPlayer2();
void turnRun();
void run();
private:
+4 -33
View File
@@ -27,12 +27,11 @@
using namespace std;
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC)
: 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),
smallBlind(sB), startCash(sC), activePlayersCounter(aP), lastPlayersTurn(0), allInCondition(0),
: myFactory(f), myBeRo(0), myGui(g), myBoard(b), playerArray(p), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), activePlayersCounter(aP), lastPlayersTurn(0), allInCondition(0),
cardsShown(false), bettingRoundsPlayed(0)
{
int i, j, k;
CardsValue myCardsValue;
@@ -166,33 +165,17 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// Dealer, SB, BB bestimmen
assignButtons();
// Preflop, Flop, Turn und River erstellen
// myPreflop = myFactory->createPreflop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
// myFlop = myFactory->createFlop(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
// myTurn = myFactory->createTurn(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
// myRiver = myFactory->createRiver(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
myBeRoFactory = myFactory->createBeRoFactory(this, myID, actualQuantityPlayers, dealerPosition, smallBlind);
int currentRound = actualRound; // for Lothar ;-)
myBeRo = myBeRoFactory->createBeRoPreflop();
myBeRo = myBeRoFactory->createBeRo();
}
LocalHand::~LocalHand()
{
delete myPreflop;
myPreflop = 0;
delete myFlop;
myFlop = 0;
delete myTurn;
myTurn = 0;
delete myRiver;
myRiver = 0;
}
void LocalHand::start() {
@@ -327,17 +310,7 @@ void LocalHand::switchRounds() {
// Spieler ermitteln, der noch nicht All In ist
if(playerArray[i]->getMyAction() != 1 && playerArray[i]->getMyAction() != 6 && playerArray[i]->getMyActiveStatus() == 1) {
tempHighestSet = 0;
switch (actualRound) {
case 0: {tempHighestSet = myBeRo->getHighestSet();}
break;
case 1: {tempHighestSet = myBeRo->getHighestSet();}
break;
case 2: {tempHighestSet = myBeRo->getHighestSet();}
break;
case 3: {tempHighestSet = myBeRo->getHighestSet();}
break;
default: {}
}
tempHighestSet = myBeRo[actualRound]->getHighestSet();
// cout << "tempHighestSet: " << tempHighestSet << "playerArray[i]->getMySet(): " << playerArray[i]->getMySet() << endl;
if(playerArray[i]->getMySet() >= tempHighestSet) {
@@ -383,8 +356,6 @@ void LocalHand::switchRounds() {
//
int currentRound = actualRound;
myBeRo = myBeRoFactory->switchRounds(myBeRo, currentRound);
// cout << "NextPlayerSpeed2 start" << endl;
switch(actualRound) {
+10 -14
View File
@@ -20,15 +20,15 @@
#ifndef LOCALHAND_H
#define LOCALHAND_H
#include <vector>
#include <boost/shared_ptr.hpp>
#include <enginefactory.h>
#include <guiinterface.h>
#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 <berofactoryinterface.h>
@@ -42,12 +42,12 @@ public:
PlayerInterface** getPlayerArray() const { return playerArray; }
BoardInterface* getBoard() const { return myBoard; }
BeRoInterface* getPreflop() const { return myBeRo; }
BeRoInterface* getFlop() const { return myBeRo; }
BeRoInterface* getTurn() const { return myBeRo; }
BeRoInterface* getRiver() const { return myBeRo; }
boost::shared_ptr<BeRoInterface> getPreflop() const { return myBeRo[actualRound]; }
boost::shared_ptr<BeRoInterface> getFlop() const { return myBeRo[actualRound]; }
boost::shared_ptr<BeRoInterface> getTurn() const { return myBeRo[actualRound]; }
boost::shared_ptr<BeRoInterface> getRiver() const { return myBeRo[actualRound]; }
GuiInterface* getGuiInterface() const { return myGui; }
BeRoInterface* getCurrentBeRo() const { return myBeRo; }
boost::shared_ptr<BeRoInterface> getCurrentBeRo() const { return myBeRo[actualRound]; }
void setMyID(int theValue) { myID = theValue; }
int getMyID() const { return myID; }
@@ -96,12 +96,8 @@ private:
GuiInterface *myGui;
BoardInterface *myBoard;
PlayerInterface **playerArray;
PreflopInterface *myPreflop;
FlopInterface *myFlop;
TurnInterface *myTurn;
RiverInterface *myRiver;
BeRoInterface *myBeRo;
BeRoFactoryInterface *myBeRoFactory;
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
int myID;
int actualQuantityPlayers;