adds activePlayerList and runningPlayerList (X) - !!! BROKEN !!! - last stable rev is 866
This commit is contained in:
@@ -12,11 +12,16 @@
|
|||||||
#ifndef BEROINTERFACE_H
|
#ifndef BEROINTERFACE_H
|
||||||
#define BEROINTERFACE_H
|
#define BEROINTERFACE_H
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
#include "game_defs.h"
|
#include "game_defs.h"
|
||||||
|
|
||||||
/**
|
class PlayerInterface;
|
||||||
@author FThauer FHammer <webmaster@pokerth.net>
|
|
||||||
*/
|
typedef boost::shared_ptr<std::list<boost::shared_ptr<PlayerInterface> > > PlayerList;
|
||||||
|
typedef std::list<boost::shared_ptr<PlayerInterface> >::iterator PlayerListIterator;
|
||||||
|
|
||||||
class BeRoInterface{
|
class BeRoInterface{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -24,10 +29,12 @@ public:
|
|||||||
|
|
||||||
virtual GameState getMyBeRoID() const =0;
|
virtual GameState getMyBeRoID() const =0;
|
||||||
|
|
||||||
|
|
||||||
virtual void setPlayersTurn(int) =0;
|
virtual void setPlayersTurn(int) =0;
|
||||||
virtual int getPlayersTurn() const =0;
|
virtual int getPlayersTurn() const =0;
|
||||||
|
|
||||||
|
virtual void setCurrentPlayersTurnIt(PlayerListIterator) =0;
|
||||||
|
virtual PlayerListIterator getCurrentPlayersTurnIt() const =0;
|
||||||
|
|
||||||
virtual void setHighestSet(int) =0;
|
virtual void setHighestSet(int) =0;
|
||||||
virtual int getHighestSet() const =0;
|
virtual int getHighestSet() const =0;
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,10 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
LocalBeRo::LocalBeRo(HandInterface* hi, int id, int dP, int sB, GameState gS)
|
LocalBeRo::LocalBeRo(HandInterface* hi, int id, int dP, int sB, GameState gS)
|
||||||
: BeRoInterface(), myHand(hi), myBeRoID(gS), myID(id), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), minimumRaise(2*sB), firstRun(1), firstRound(1), firstHeadsUpRound(1), playersTurn(dP), logBoardCardsDone(0)
|
: BeRoInterface(), myHand(hi), myBeRoID(gS), myID(id), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), minimumRaise(2*sB), firstRun(1), firstRound(1), firstHeadsUpRound(1), logBoardCardsDone(0)
|
||||||
{
|
{
|
||||||
|
currentPlayersTurnIt = myHand->getRunningPlayerList()->begin();
|
||||||
|
lastPlayersTurnIt = myHand->getRunningPlayerList()->begin();
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -33,7 +35,12 @@ LocalBeRo::~LocalBeRo()
|
|||||||
|
|
||||||
void LocalBeRo::nextPlayer() {
|
void LocalBeRo::nextPlayer() {
|
||||||
|
|
||||||
myHand->getPlayerArray()[playersTurn]->action();
|
// myHand->getPlayerArray()[playersTurn]->action();
|
||||||
|
|
||||||
|
|
||||||
|
cout << "playerID in nextPlayer(): " << (*currentPlayersTurnIt)->getMyID() << endl;
|
||||||
|
|
||||||
|
(*currentPlayersTurnIt)->action();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public:
|
|||||||
GameState getMyBeRoID() const { return myBeRoID; }
|
GameState getMyBeRoID() const { return myBeRoID; }
|
||||||
|
|
||||||
int getHighestCardsValue() const { std::cout << "getHighestCardsValue() in wrong BeRo" << std::endl; return 0; }
|
int getHighestCardsValue() const { std::cout << "getHighestCardsValue() in wrong BeRo" << std::endl; return 0; }
|
||||||
void setHighestCardsValue(int theValue) { }
|
void setHighestCardsValue(int /*theValue*/) { }
|
||||||
|
|
||||||
void setMinimumRaise ( int theValue ) { minimumRaise = theValue; }
|
void setMinimumRaise ( int theValue ) { minimumRaise = theValue; }
|
||||||
int getMinimumRaise() const { return minimumRaise; }
|
int getMinimumRaise() const { return minimumRaise; }
|
||||||
@@ -51,7 +51,13 @@ protected:
|
|||||||
void setDealerPosition(int theValue) { dealerPosition = theValue; }
|
void setDealerPosition(int theValue) { dealerPosition = theValue; }
|
||||||
|
|
||||||
void setPlayersTurn(int theValue) { playersTurn = theValue; }
|
void setPlayersTurn(int theValue) { playersTurn = theValue; }
|
||||||
int getPlayersTurn() const { return playersTurn; }
|
int getPlayersTurn() const { return playersTurn;}
|
||||||
|
|
||||||
|
void setCurrentPlayersTurnIt(PlayerListIterator theValue) { currentPlayersTurnIt = theValue; }
|
||||||
|
PlayerListIterator getCurrentPlayersTurnIt() const { return currentPlayersTurnIt; }
|
||||||
|
|
||||||
|
void setLastPlayersTurnIt(PlayerListIterator theValue) { lastPlayersTurnIt = theValue; }
|
||||||
|
PlayerListIterator getLastPlayersTurnIt() const { return lastPlayersTurnIt; }
|
||||||
|
|
||||||
void setHighestSet(int theValue) { highestSet = theValue; }
|
void setHighestSet(int theValue) { highestSet = theValue; }
|
||||||
int getHighestSet() const { return highestSet;}
|
int getHighestSet() const { return highestSet;}
|
||||||
@@ -87,7 +93,10 @@ private:
|
|||||||
bool firstRun;
|
bool firstRun;
|
||||||
bool firstRound;
|
bool firstRound;
|
||||||
bool firstHeadsUpRound;
|
bool firstHeadsUpRound;
|
||||||
int playersTurn;
|
|
||||||
|
int playersTurn; // TODO -> delete
|
||||||
|
PlayerListIterator currentPlayersTurnIt; // iterator for runningPlayerList
|
||||||
|
PlayerListIterator lastPlayersTurnIt; // iterator for runningPlayerList
|
||||||
|
|
||||||
bool logBoardCardsDone;
|
bool logBoardCardsDone;
|
||||||
|
|
||||||
|
|||||||
@@ -29,19 +29,90 @@ LocalBeRoPreflop::LocalBeRoPreflop(HandInterface* hi, int id, int dP, int sB) :
|
|||||||
{
|
{
|
||||||
setHighestSet(2*getSmallBlind());
|
setHighestSet(2*getSmallBlind());
|
||||||
|
|
||||||
// // BigBlind ermitteln
|
// determine bigBlindPlayer
|
||||||
PlayerListIterator it;
|
|
||||||
|
|
||||||
bigBlindPositionIt = getMyHand()->getActivePlayerList()->begin();
|
bigBlindPositionIt = getMyHand()->getActivePlayerList()->begin();
|
||||||
|
|
||||||
for(bigBlindPositionIt=getMyHand()->getActivePlayerList()->begin(); bigBlindPositionIt!=getMyHand()->getActivePlayerList()->end(); bigBlindPositionIt++) {
|
for(bigBlindPositionIt=getMyHand()->getActivePlayerList()->begin(); bigBlindPositionIt!=getMyHand()->getActivePlayerList()->end(); bigBlindPositionIt++) {
|
||||||
if((*bigBlindPositionIt)->getMyButton() == BUTTON_BIG_BLIND) break;
|
if((*bigBlindPositionIt)->getMyButton() == BUTTON_BIG_BLIND) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bigBlindPositionIt == getMyHand()->getActivePlayerList()->end()) cout << "!!!" << endl;
|
// search player in runningPlayerList before first action player -> run() determine next player who will do first action
|
||||||
|
PlayerListIterator it_1, it_2;
|
||||||
|
|
||||||
|
// search bigBlindPosition in runningPlayerList
|
||||||
|
it_1 = find(getMyHand()->getRunningPlayerList()->begin(), getMyHand()->getRunningPlayerList()->end(), *bigBlindPositionIt);
|
||||||
|
|
||||||
|
// more than 2 players are still active -> runningPlayerList is not empty
|
||||||
|
if(getMyHand()->getActivePlayerList()->size() > 2) {
|
||||||
|
|
||||||
|
// bigBlindPlayer not found in runningPlayerList (he is all in) -> bigBlindPlayer is not the running player before first action player
|
||||||
|
if(it_1 == getMyHand()->getRunningPlayerList()->end()) {
|
||||||
|
|
||||||
|
// search smallBlindPosition in runningPlayerList
|
||||||
|
PlayerListIterator smallBlindPositionIt = bigBlindPositionIt;
|
||||||
|
smallBlindPositionIt--;
|
||||||
|
it_2 = find(getMyHand()->getRunningPlayerList()->begin(), getMyHand()->getRunningPlayerList()->end(), *smallBlindPositionIt);
|
||||||
|
|
||||||
|
// smallBlindPlayer not found in runningPlayerList (he is all in) -> next active player before smallBlindPlayer is running player before first action player
|
||||||
|
if(it_2 == getMyHand()->getRunningPlayerList()->end()) {
|
||||||
|
it_2 = smallBlindPositionIt;
|
||||||
|
it_2--;
|
||||||
|
setLastPlayersTurnIt(it_2);
|
||||||
|
}
|
||||||
|
// smallBlindPlayer found in runningPlayerList -> running player before first action player
|
||||||
|
else {
|
||||||
|
setLastPlayersTurnIt(it_2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// bigBlindPlayer found in runningPlayerList -> player before first action player
|
||||||
|
else {
|
||||||
|
setLastPlayersTurnIt(it_1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// heads up -> dealer/smallBlindPlayer is first action player and bigBlindPlayer is player before
|
||||||
|
else {
|
||||||
|
setLastPlayersTurnIt(it_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
setCurrentPlayersTurnIt(getLastPlayersTurnIt());
|
||||||
|
|
||||||
|
cout << "playerID constructor preflopRun(): " << (*(getCurrentPlayersTurnIt()))->getMyID() << endl;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////// testing
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
it_1 = find(getMyHand()->getRunningPlayerList()->begin(), getMyHand()->getRunningPlayerList()->end(), *bigBlindPositionIt);
|
||||||
|
|
||||||
|
// bigBlindPosition is not all in
|
||||||
|
// if(it!=getMyHand()->getRunningPlayerList()->end()) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// if(it_1!=getMyHand()->getRunningPlayerList()->end()) {
|
||||||
|
// cout << getMyHand()->getMyID() << ": " << "gefunden!" << endl;
|
||||||
|
// cout << "\t PlayerID: " << (*it_1)->getMyID() << endl;
|
||||||
|
// it_2 = it_1;
|
||||||
|
// if(it_1 == getMyHand()->getRunningPlayerList()->begin()) it_1 = getMyHand()->getRunningPlayerList()->end();
|
||||||
|
// it_1--;
|
||||||
|
// cout << "\t PlayerID vor bigBlind: " << (*it_1)->getMyID() << endl;
|
||||||
|
// cout << "\t PlayerID vor bigBlind: " << (*it_2)->getMyID() << endl;
|
||||||
|
// } else {
|
||||||
|
// cout << getMyHand()->getMyID() << ": " << "nicht gefunden" << endl;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
//////////////// old
|
||||||
|
|
||||||
|
// set first runningPlayer before bigBlindPlayer to playersTurn -> run() determine next one who will do first action
|
||||||
|
// setPlayersTurn((*bigBlindPositionIt)->getMyID());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// // erste Spielernummer fr preflopRun() setzen
|
|
||||||
setPlayersTurn((*bigBlindPositionIt)->getMyID());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,6 +131,8 @@ void LocalBeRoPreflop::run() {
|
|||||||
bool allHighestSet = true;
|
bool allHighestSet = true;
|
||||||
PlayerListIterator it;
|
PlayerListIterator it;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// test if all running players have same sets (else allHighestSet = false)
|
// test if all running players have same sets (else allHighestSet = false)
|
||||||
for(it=getMyHand()->getRunningPlayerList()->begin(); it!=getMyHand()->getRunningPlayerList()->end(); it++) {
|
for(it=getMyHand()->getRunningPlayerList()->begin(); it!=getMyHand()->getRunningPlayerList()->end(); it++) {
|
||||||
if(getHighestSet() != (*it)->getMySet()) {
|
if(getHighestSet() != (*it)->getMySet()) {
|
||||||
@@ -68,17 +141,41 @@ void LocalBeRoPreflop::run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// determine next player
|
// determine next player
|
||||||
for(i=0; (i<MAX_NUMBER_OF_PLAYERS && (!(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyActiveStatus()) || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_FOLD || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_ALLIN)) || i==0; i++) {
|
|
||||||
|
|
||||||
setPlayersTurn((getPlayersTurn()+1)%(MAX_NUMBER_OF_PLAYERS));
|
cout << "playerID begin preflopRun(): " << (*(getCurrentPlayersTurnIt()))->getMyID() << endl;
|
||||||
// falls BigBlind, dann PreflopFirstRound zuende
|
|
||||||
if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_BIG_BLIND && (*bigBlindPositionIt)->getMySet() < 2*getSmallBlind()) setFirstRound(0);
|
it = getCurrentPlayersTurnIt();
|
||||||
// if next player is small blind and only all-in-big-blind with <= 2*smallblind is nonfold too
|
|
||||||
if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_SMALL_BLIND && (*bigBlindPositionIt)->getMySet() < 2*getSmallBlind() && getMyHand()->getRunningPlayerList()->size() == 1) {
|
it++;
|
||||||
setFirstRound(0);
|
|
||||||
|
setCurrentPlayersTurnIt(it);
|
||||||
|
|
||||||
|
if(getCurrentPlayersTurnIt() == getMyHand()->getRunningPlayerList()->end()) setCurrentPlayersTurnIt(getMyHand()->getRunningPlayerList()->begin());
|
||||||
|
|
||||||
|
if(getCurrentPlayersTurnIt() == getMyHand()->getRunningPlayerList()->end()) cout << "!!!" << endl;
|
||||||
|
|
||||||
|
cout << "playerID middle preflopRun(): " << (*(getCurrentPlayersTurnIt()))->getMyID() << endl;
|
||||||
|
|
||||||
|
// exceptions
|
||||||
|
// if next player is small blind and only all-in-big-blind with less than smallblind amount is nonfold too -> preflop is over
|
||||||
|
if((*(getCurrentPlayersTurnIt()))->getMyButton() == BUTTON_SMALL_BLIND && (*bigBlindPositionIt)->getMySet() <= getSmallBlind() && getMyHand()->getRunningPlayerList()->size() == 1) {
|
||||||
|
setFirstRound(false);
|
||||||
allHighestSet = true;
|
allHighestSet = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// determine next player
|
||||||
|
// for(i=0; (i<MAX_NUMBER_OF_PLAYERS && (!(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyActiveStatus()) || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_FOLD || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_ALLIN)) || i==0; i++) {
|
||||||
|
//
|
||||||
|
// setPlayersTurn((getPlayersTurn()+1)%(MAX_NUMBER_OF_PLAYERS));
|
||||||
|
// // falls BigBlind, dann PreflopFirstRound zuende
|
||||||
|
// if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_BIG_BLIND && (*bigBlindPositionIt)->getMySet() < 2*getSmallBlind()) setFirstRound(false);
|
||||||
|
// // if next player is small blind and only all-in-big-blind with <= 2*smallblind is nonfold too
|
||||||
|
// if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_SMALL_BLIND && (*bigBlindPositionIt)->getMySet() <= getSmallBlind() && getMyHand()->getRunningPlayerList()->size() == 1) {
|
||||||
|
// setFirstRound(false);
|
||||||
|
// allHighestSet = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// prfen, ob Preflop wirklich dran ist
|
// prfen, ob Preflop wirklich dran ist
|
||||||
if(!getFirstRound() && allHighestSet) {
|
if(!getFirstRound() && allHighestSet) {
|
||||||
@@ -88,9 +185,15 @@ void LocalBeRoPreflop::run() {
|
|||||||
getMyHand()->setActualRound(GAME_STATE_FLOP);
|
getMyHand()->setActualRound(GAME_STATE_FLOP);
|
||||||
|
|
||||||
//Action loeschen und ActionButtons refresh
|
//Action loeschen und ActionButtons refresh
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
for(it=getMyHand()->getRunningPlayerList()->begin(); it!=getMyHand()->getRunningPlayerList()->end(); it++) {
|
||||||
if(getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD && getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_ALLIN) getMyHand()->getPlayerArray()[i]->setMyAction(PLAYER_ACTION_NONE);
|
(*it)->setMyAction(PLAYER_ACTION_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Action loeschen und ActionButtons refresh
|
||||||
|
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
|
// if(getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD && getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_ALLIN) getMyHand()->getPlayerArray()[i]->setMyAction(PLAYER_ACTION_NONE);
|
||||||
|
// }
|
||||||
|
|
||||||
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
|
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
|
||||||
getMyHand()->getBoard()->collectSets();
|
getMyHand()->getBoard()->collectSets();
|
||||||
getMyHand()->getBoard()->collectPot();
|
getMyHand()->getBoard()->collectPot();
|
||||||
@@ -106,14 +209,27 @@ void LocalBeRoPreflop::run() {
|
|||||||
// Preflop ist wirklich dran
|
// Preflop ist wirklich dran
|
||||||
|
|
||||||
// falls BigBlind, dann PreflopFirstRound zuende
|
// falls BigBlind, dann PreflopFirstRound zuende
|
||||||
if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_BIG_BLIND) setFirstRound(0);
|
// if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_BIG_BLIND) setFirstRound(0);
|
||||||
|
|
||||||
|
// lastPlayersTurn -> PreflopFirstRound is over
|
||||||
|
if( (*(getCurrentPlayersTurnIt())) == (*(getLastPlayersTurnIt())) ) {
|
||||||
|
setFirstRound(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// getMyHand()->getPlayerArray()[getPlayersTurn()]->setMyTurn(1);
|
||||||
|
|
||||||
|
(*(getCurrentPlayersTurnIt()))->setMyTurn(true);
|
||||||
|
|
||||||
getMyHand()->getPlayerArray()[getPlayersTurn()]->setMyTurn(1);
|
|
||||||
//highlight active players groupbox and clear action
|
//highlight active players groupbox and clear action
|
||||||
getMyHand()->getGuiInterface()->refreshGroupbox(getPlayersTurn(),2);
|
// getMyHand()->getGuiInterface()->refreshGroupbox(getPlayersTurn(),2);
|
||||||
getMyHand()->getGuiInterface()->refreshAction(getPlayersTurn(),PLAYER_ACTION_NONE);
|
// getMyHand()->getGuiInterface()->refreshAction(getPlayersTurn(),PLAYER_ACTION_NONE);
|
||||||
|
|
||||||
if(getPlayersTurn() == 0) {
|
//highlight active players groupbox and clear action
|
||||||
|
getMyHand()->getGuiInterface()->refreshGroupbox( (*(getCurrentPlayersTurnIt()))->getMyID() , 2 );
|
||||||
|
getMyHand()->getGuiInterface()->refreshAction( (*(getCurrentPlayersTurnIt()))->getMyID() , PLAYER_ACTION_NONE );
|
||||||
|
|
||||||
|
|
||||||
|
if((*(getCurrentPlayersTurnIt()))->getMyID() == 0) {
|
||||||
// Wir sind dran
|
// Wir sind dran
|
||||||
getMyHand()->getGuiInterface()->meInAction();
|
getMyHand()->getGuiInterface()->meInAction();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public:
|
|||||||
void run();
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PlayerListIterator bigBlindPositionIt;
|
PlayerListIterator bigBlindPositionIt; // iterator for activePlayerList
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -105,43 +105,43 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
|||||||
|
|
||||||
case 1: {
|
case 1: {
|
||||||
|
|
||||||
tempBoardArray[0] = 5;
|
// tempBoardArray[0] = 5;
|
||||||
tempBoardArray[1] = 51;
|
// tempBoardArray[1] = 51;
|
||||||
tempBoardArray[2] = 3;
|
// tempBoardArray[2] = 3;
|
||||||
tempBoardArray[3] = 21;
|
// tempBoardArray[3] = 21;
|
||||||
tempBoardArray[4] = 13;
|
// tempBoardArray[4] = 13;
|
||||||
|
//
|
||||||
myBoard->setMyCards(tempBoardArray);
|
// myBoard->setMyCards(tempBoardArray);
|
||||||
|
//
|
||||||
tempPlayerAndBoardArray[2] = tempBoardArray[0];
|
// tempPlayerAndBoardArray[2] = tempBoardArray[0];
|
||||||
tempPlayerAndBoardArray[3] = tempBoardArray[1];
|
// tempPlayerAndBoardArray[3] = tempBoardArray[1];
|
||||||
tempPlayerAndBoardArray[4] = tempBoardArray[2];
|
// tempPlayerAndBoardArray[4] = tempBoardArray[2];
|
||||||
tempPlayerAndBoardArray[5] = tempBoardArray[3];
|
// tempPlayerAndBoardArray[5] = tempBoardArray[3];
|
||||||
tempPlayerAndBoardArray[6] = tempBoardArray[4];
|
// tempPlayerAndBoardArray[6] = tempBoardArray[4];
|
||||||
|
//
|
||||||
// player0
|
// // player0
|
||||||
|
//
|
||||||
tempPlayerArray[0] = 7;
|
// tempPlayerArray[0] = 7;
|
||||||
tempPlayerArray[1] = 37;
|
// tempPlayerArray[1] = 37;
|
||||||
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
||||||
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
||||||
|
//
|
||||||
playerArray[0]->setMyCards(tempPlayerArray);
|
// playerArray[0]->setMyCards(tempPlayerArray);
|
||||||
playerArray[0]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
// playerArray[0]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
||||||
|
//
|
||||||
playerArray[0]->setMyBestHandPosition(temp5Array);
|
// playerArray[0]->setMyBestHandPosition(temp5Array);
|
||||||
|
//
|
||||||
// player1
|
// // player1
|
||||||
|
//
|
||||||
tempPlayerArray[0] = 24;
|
// tempPlayerArray[0] = 24;
|
||||||
tempPlayerArray[1] = 19;
|
// tempPlayerArray[1] = 19;
|
||||||
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
||||||
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
||||||
|
//
|
||||||
playerArray[1]->setMyCards(tempPlayerArray);
|
// playerArray[1]->setMyCards(tempPlayerArray);
|
||||||
playerArray[1]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
// playerArray[1]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
||||||
|
//
|
||||||
playerArray[1]->setMyBestHandPosition(temp5Array);
|
// playerArray[1]->setMyBestHandPosition(temp5Array);
|
||||||
|
|
||||||
// player2
|
// player2
|
||||||
|
|
||||||
@@ -157,27 +157,27 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
|||||||
|
|
||||||
// player3
|
// player3
|
||||||
|
|
||||||
tempPlayerArray[0] = 38;
|
// tempPlayerArray[0] = 38;
|
||||||
tempPlayerArray[1] = 22;
|
// tempPlayerArray[1] = 22;
|
||||||
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
||||||
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
||||||
|
//
|
||||||
playerArray[3]->setMyCards(tempPlayerArray);
|
// playerArray[3]->setMyCards(tempPlayerArray);
|
||||||
playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
// playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
||||||
|
//
|
||||||
playerArray[3]->setMyBestHandPosition(temp5Array);
|
// playerArray[3]->setMyBestHandPosition(temp5Array);
|
||||||
|
|
||||||
// player4
|
// player4
|
||||||
|
|
||||||
tempPlayerArray[0] = 25;
|
// tempPlayerArray[0] = 25;
|
||||||
tempPlayerArray[1] = 16;
|
// tempPlayerArray[1] = 16;
|
||||||
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
|
||||||
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
|
||||||
|
//
|
||||||
playerArray[3]->setMyCards(tempPlayerArray);
|
// playerArray[3]->setMyCards(tempPlayerArray);
|
||||||
playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
// playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
|
||||||
|
//
|
||||||
playerArray[3]->setMyBestHandPosition(temp5Array);
|
// playerArray[3]->setMyBestHandPosition(temp5Array);
|
||||||
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
@@ -367,6 +367,8 @@ void LocalHand::assignButtons() {
|
|||||||
|
|
||||||
void LocalHand::switchRounds() {
|
void LocalHand::switchRounds() {
|
||||||
|
|
||||||
|
// cout << "playerID begin switchRounds(): " << getCurrentBeRo()->get
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
PlayerListIterator it;
|
PlayerListIterator it;
|
||||||
|
|
||||||
|
|||||||
@@ -856,23 +856,23 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
|
|||||||
|
|
||||||
if(myID==0) {
|
if(myID==0) {
|
||||||
// myActiveStatus=0;
|
// myActiveStatus=0;
|
||||||
myCash=14800;
|
// myCash=14800;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myID==1) {
|
if(myID==1) {
|
||||||
myCash=400;
|
// myCash=400;
|
||||||
}
|
}
|
||||||
if(myID==2) {
|
if(myID==2) {
|
||||||
myCash=4950;
|
myCash=50;
|
||||||
}
|
}
|
||||||
if(myID==3) {
|
if(myID==3) {
|
||||||
myCash=5250;
|
// myCash=5250;
|
||||||
}
|
}
|
||||||
if(myID==4) {
|
if(myID==4) {
|
||||||
myCash=5100;
|
// myCash=5100;
|
||||||
}
|
}
|
||||||
if(myID==5) {
|
if(myID==5) {
|
||||||
myCash=4500;
|
// myCash=4500;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -976,7 +976,7 @@ void LocalPlayer::action() {
|
|||||||
actualHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, mySet);
|
actualHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, mySet);
|
||||||
actualHand->getGuiInterface()->nextPlayerAnimation();
|
actualHand->getGuiInterface()->nextPlayerAnimation();
|
||||||
|
|
||||||
|
cout << "playerID in action(): " << (*(actualHand->getCurrentBeRo()->getCurrentPlayersTurnIt()))->getMyID() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1183,7 +1183,7 @@ void LocalPlayer::preflopEngine() {
|
|||||||
|
|
||||||
switch(actualHand->getMyID()) {
|
switch(actualHand->getMyID()) {
|
||||||
case 1: {
|
case 1: {
|
||||||
myAction = PLAYER_ACTION_CALL;
|
// myAction = PLAYER_ACTION_CALL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: {
|
case 2: {
|
||||||
@@ -1201,7 +1201,7 @@ void LocalPlayer::preflopEngine() {
|
|||||||
|
|
||||||
switch(actualHand->getMyID()) {
|
switch(actualHand->getMyID()) {
|
||||||
case 1: {
|
case 1: {
|
||||||
myAction = PLAYER_ACTION_FOLD;
|
// myAction = PLAYER_ACTION_FOLD;
|
||||||
// raise = 20;
|
// raise = 20;
|
||||||
// if(mySet >= 40) {
|
// if(mySet >= 40) {
|
||||||
// myAction = PLAYER_ACTION_CALL;
|
// myAction = PLAYER_ACTION_CALL;
|
||||||
@@ -1223,15 +1223,15 @@ void LocalPlayer::preflopEngine() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: {
|
case 3: {
|
||||||
myAction = PLAYER_ACTION_CALL;
|
// myAction = PLAYER_ACTION_CALL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: {
|
case 4: {
|
||||||
myAction = PLAYER_ACTION_CALL;
|
// myAction = PLAYER_ACTION_CALL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5: {
|
case 5: {
|
||||||
myAction = PLAYER_ACTION_FOLD;
|
// myAction = PLAYER_ACTION_FOLD;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: {}
|
default: {}
|
||||||
|
|||||||
@@ -67,6 +67,30 @@ ClientBeRo::getPlayersTurn() const
|
|||||||
return playersTurn;
|
return playersTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClientBeRo::setCurrentPlayersTurnIt(PlayerListIterator theValue)
|
||||||
|
{
|
||||||
|
currentPlayersTurnIt = theValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerListIterator
|
||||||
|
ClientBeRo::getCurrentPlayersTurnIt() const
|
||||||
|
{
|
||||||
|
return currentPlayersTurnIt;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClientBeRo::setLastPlayersTurnIt(PlayerListIterator theValue)
|
||||||
|
{
|
||||||
|
lastPlayersTurnIt = theValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerListIterator
|
||||||
|
ClientBeRo::getLastPlayersTurnIt() const
|
||||||
|
{
|
||||||
|
return lastPlayersTurnIt;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ClientBeRo::setHighestSet(int theValue)
|
ClientBeRo::setHighestSet(int theValue)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,6 +36,12 @@ public:
|
|||||||
void setPlayersTurn(int theValue);
|
void setPlayersTurn(int theValue);
|
||||||
int getPlayersTurn() const;
|
int getPlayersTurn() const;
|
||||||
|
|
||||||
|
void setCurrentPlayersTurnIt(PlayerListIterator theValue);
|
||||||
|
PlayerListIterator getCurrentPlayersTurnIt() const;
|
||||||
|
|
||||||
|
void setLastPlayersTurnIt(PlayerListIterator theValue);
|
||||||
|
PlayerListIterator getLastPlayersTurnIt() const;
|
||||||
|
|
||||||
void setHighestSet(int theValue);
|
void setHighestSet(int theValue);
|
||||||
int getHighestSet() const;
|
int getHighestSet() const;
|
||||||
|
|
||||||
@@ -68,7 +74,11 @@ private:
|
|||||||
HandInterface *myHand;
|
HandInterface *myHand;
|
||||||
|
|
||||||
int highestCardsValue;
|
int highestCardsValue;
|
||||||
int playersTurn;
|
|
||||||
|
int playersTurn; // TODO -> delete
|
||||||
|
PlayerListIterator currentPlayersTurnIt; // iterator for runningPlayerList
|
||||||
|
PlayerListIterator lastPlayersTurnIt; // iterator for runningPlayerList
|
||||||
|
|
||||||
int highestSet;
|
int highestSet;
|
||||||
bool firstRound;
|
bool firstRound;
|
||||||
int smallBlindPosition;
|
int smallBlindPosition;
|
||||||
|
|||||||
+6
-3
@@ -210,8 +210,11 @@ boost::shared_ptr<PlayerInterface> Game::getPlayerByUniqueId(unsigned id)
|
|||||||
|
|
||||||
boost::shared_ptr<PlayerInterface> Game::getCurrentPlayer()
|
boost::shared_ptr<PlayerInterface> Game::getCurrentPlayer()
|
||||||
{
|
{
|
||||||
int curPlayerNum = getCurrentHand()->getCurrentBeRo()->getPlayersTurn();
|
// int curPlayerNum = getCurrentHand()->getCurrentBeRo()->getPlayersTurn();
|
||||||
assert(curPlayerNum < getStartQuantityPlayers());
|
// assert(curPlayerNum < getStartQuantityPlayers());
|
||||||
return getPlayerArray()[curPlayerNum];
|
// return getPlayerArray()[curPlayerNum];
|
||||||
|
|
||||||
|
// TODO -> checking
|
||||||
|
return (*(getCurrentHand()->getCurrentBeRo()->getCurrentPlayersTurnIt()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -735,7 +735,7 @@ void mainWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
|
|||||||
startData.numberOfPlayers = gameData.maxNumberOfPlayers;
|
startData.numberOfPlayers = gameData.maxNumberOfPlayers;
|
||||||
Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0);
|
Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0);
|
||||||
if(DEBUG_MODE) {
|
if(DEBUG_MODE) {
|
||||||
tmpDealerPos = 3;
|
tmpDealerPos = 1;
|
||||||
}
|
}
|
||||||
startData.startDealerPlayerId = static_cast<unsigned>(tmpDealerPos);
|
startData.startDealerPlayerId = static_cast<unsigned>(tmpDealerPos);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user