checkMyAction()

This commit is contained in:
floty
2007-10-09 21:19:22 +00:00
parent 12bbe999a4
commit f3b3fd9d7c
3 changed files with 57 additions and 0 deletions
+54
View File
@@ -934,6 +934,11 @@ void LocalPlayer::setHand(HandInterface* br) { actualHand = br; }
void LocalPlayer::action() {
// int myOldCash = myCash;
// int oldHighestSet = actualHand->getCurrentBeRo()->getHighestSet();
// int oldMinimumRaise = actualHand->getCurrentBeRo()->getMinimumRaise();
// int myOldSet = mySet;
switch(actualHand->getActualRound()) {
case 0: {
@@ -974,6 +979,9 @@ void LocalPlayer::action() {
default: {}
}
// cout << checkMyAction(myAction, mySet - myOldSet, myOldSet, myOldCash, oldHighestSet, oldMinimumRaise, actualHand->getSmallBlind()) << endl;
myTurn = 0;
// cout << "jetzt" << endl;
@@ -986,6 +994,52 @@ void LocalPlayer::action() {
// cout << "playerID in action(): " << (*(actualHand->getCurrentBeRo()->getCurrentPlayersTurnIt()))->getMyID() << endl;
}
int LocalPlayer::checkMyAction(int targetAction, int targetBet, int alreadySet, int myCash, int highestSet, int minimumRaise, int smallBlind) {
switch(targetAction) {
case PLAYER_ACTION_FOLD: {
return 0;
} break;
case PLAYER_ACTION_CHECK: {
if(alreadySet == highestSet) {
return 0;
}
} break;
case PLAYER_ACTION_CALL: {
if(alreadySet < highestSet && targetBet <= myCash) {
// not all in
if(myCash + alreadySet >= highestSet && targetBet == highestSet - alreadySet) {
return 0;
}
// all in
if(myCash + alreadySet <= highestSet) {
return 0;
}
}
} break;
case PLAYER_ACTION_BET: {
if(highestSet == 0 && targetBet <= myCash && targetBet >= 2*smallBlind) {
return 0;
}
} break;
case PLAYER_ACTION_RAISE: {
if(highestSet > 0 && targetBet >= minimumRaise && targetBet <= myCash) {
return 0;
}
} break;
case PLAYER_ACTION_ALLIN: {
if(targetBet == myCash) {
return 0;
}
} break;
default: {
}
}
return 1;
}
void LocalPlayer::preflopEngine() {