From be37505d94d3f2cd7a95c0503e54034e78111824 Mon Sep 17 00:00:00 2001 From: doitux Date: Tue, 20 Mar 2007 00:41:39 +0000 Subject: [PATCH] --- src/engine/local_engine/localplayer.cpp | 229 ++++++++++++++++++++++- src/gui/qt/mainwindow/mainwindowimpl.cpp | 2 +- 2 files changed, 227 insertions(+), 4 deletions(-) diff --git a/src/engine/local_engine/localplayer.cpp b/src/engine/local_engine/localplayer.cpp index 52d1c902..c916feb0 100755 --- a/src/engine/local_engine/localplayer.cpp +++ b/src/engine/local_engine/localplayer.cpp @@ -666,7 +666,14 @@ void LocalPlayer::flopEngine() { int tempArray[5]; int boardCards[5]; int info[4]; + int cBluff; + int sBluff; + int bet = 0; + int raise = 0; + int i; + + Tools myTools; for(i=0; i<2; i++) tempArray[i] = myCards[i]; actualBoard->getMyCards(boardCards); @@ -684,7 +691,219 @@ void LocalPlayer::flopEngine() { // aktive Situation --> check / bet if(actualHand->getFlop()->getHighestSet() == 0) { + switch(info[0]) { + case 9: {} + case 8: {} + case 7: {} + case 6: {} + case 5: {} + case 4: { + myTools.getRandNumber(0,100,1,&cBluff,0); + if(cBluff < 35) { + myAction = 2; + } + else { + if(myCash/(2*actualHand->getSmallBlind()) <= 8) { + myAction = 6; + } else { + if(cBluff < 60) { + bet = (7-myDude4)*2*actualHand->getSmallBlind(); + } else { + bet = (((100-cBluff)/20)+2)*actualHand->getSmallBlind(); + } + if(bet < 2*actualHand->getSmallBlind()) bet = 2*actualHand->getSmallBlind(); + myAction = 4; + } + } + } + break; + case 3: { + switch(info[3]) { + case 2: { + myTools.getRandNumber(0,100,1,&cBluff,0); + if(cBluff < 35) { + myAction = 2; + } + else { + if(myCash/(2*actualHand->getSmallBlind()) <= 8) { + myAction = 6; + } else { + if(cBluff < 60) { + bet = (5-myDude4)*2*actualHand->getSmallBlind(); + } else { + bet = (((100-cBluff)/20)+2)*actualHand->getSmallBlind(); + } + if(bet < 2*actualHand->getSmallBlind()) bet = 2*actualHand->getSmallBlind(); + myAction = 4; + } + } + } + break; + case 1: { + myTools.getRandNumber(0,100,1,&cBluff,0); + if(cBluff < 40) { + myAction = 2; + } + else { + if(myCash/(2*actualHand->getSmallBlind()) <= 6) { + myAction = 6; + } else { + if(cBluff < 60) { + bet = (3-myDude4)*2*actualHand->getSmallBlind(); + } else { + bet = (((100-cBluff)/20)+2)*actualHand->getSmallBlind(); + } + if(bet < 2*actualHand->getSmallBlind()) bet = 2*actualHand->getSmallBlind(); + myAction = 4; + } + } + } + break; + default: { + myTools.getRandNumber(0,100,1,&sBluff,0); + if(info[1] >= 10 && sBluff <= 40) { + bet = (sBluff/10)*2*actualHand->getSmallBlind(); + if(bet < 2*actualHand->getSmallBlind()) bet = 2*actualHand->getSmallBlind(); + myAction = 4; + } + else { + myAction = 2; + } + } + } + } + break; + case 2: { + switch(info[3]) { + case 2: { + myTools.getRandNumber(0,100,1,&cBluff,0); + if(cBluff > 80) { + myAction = 2; + } + else { + if(myCash/(2*actualHand->getSmallBlind()) <= 6) { + myAction = 6; + } else { + bet = (cBluff/20)*2*actualHand->getSmallBlind(); + if(bet < 2*actualHand->getSmallBlind()) bet = 2*actualHand->getSmallBlind(); + myAction = 4; + } + } + } + break; + default: { + myTools.getRandNumber(0,100,1,&cBluff,0); + if(cBluff > 90) { + myAction = 2; + } + else { + if(myCash/(2*actualHand->getSmallBlind()) <= 5) { + myAction = 6; + } else { + bet = (cBluff/30)*2*actualHand->getSmallBlind(); + if(bet < 2*actualHand->getSmallBlind()) bet = 2*actualHand->getSmallBlind(); + myAction = 4; + } + } + } + } + } + break; + case 1: { + if(!info[2]) { + myTools.getRandNumber(0,100,1,&sBluff,0); + switch(info[3]) { + case 2: {} + case 1: { + if(actualHand->getActualQuantityPlayers() == 2) { + bet = (1-myDude4)*2*actualHand->getSmallBlind(); + if(bet < 2*actualHand->getSmallBlind()) bet = 2*actualHand->getSmallBlind(); + myAction = 4; + } + else { + switch(info[1]) { + case 3: { + if(sBluff <= 10) { + bet = (sBluff/5 + 2)*actualHand->getSmallBlind(); + myAction = 4; + } + else { + myAction = 2; + } + } + break; + case 2: { + if(sBluff <= 15) { + bet = (sBluff/5 + 2)*actualHand->getSmallBlind(); + myAction = 4; + } + else { + myAction = 2; + } + } + break; + case 1: { + if(sBluff <= 50) { + bet = (sBluff/15 + 2)*actualHand->getSmallBlind(); + myAction = 4; + } + else { + myAction = 2; + } + } + break; + default: { + if(myCash/(2*actualHand->getSmallBlind()) <= 5) { + myAction = 6; + } else { + bet = (sBluff/15)*2*actualHand->getSmallBlind(); + if(bet < 2*actualHand->getSmallBlind()) bet = 2*actualHand->getSmallBlind(); + myAction = 4; + } + } + break; + } + } + } + break; + default: { + if(sBluff > 90) { + myAction = 2; + } + else { + if(myCash/(2*actualHand->getSmallBlind()) <= 5) { + myAction = 6; + } else { + bet = (cBluff/30)*2*actualHand->getSmallBlind(); + if(bet < 2*actualHand->getSmallBlind()) bet = 2*actualHand->getSmallBlind(); + myAction = 4; + } + } + } + } + } + + + + + + + + + + + + + + + + + + } + break; + default: {} + } @@ -1356,7 +1575,8 @@ int LocalPlayer::flopCardsValue(int* cards, int* info) { for(j1=0; j1<3; j1++) { if(array[j1][1] == array[j1+1][1] && array[j1][1] == array[j1+2][1]) { info[0] = 3; - info[1] = array[j1][1]; + if(j1==0) info[1] = array[3][1]; + else info[1] = array[0][1]; for(j2=0; j2<3; j2++) { if(array[j1+j2][2] <= 1) info[3]++; } @@ -1385,11 +1605,14 @@ int LocalPlayer::flopCardsValue(int* cards, int* info) { for(j1=0; j1<4; j1++) { if(array[j1][1] == array[j1+1][1]) { info[0] = 1; - info[1] = array[j1][1]; + info[1] = 0; + for(j2=0; j2<5; j2++) { + if(array[j2][2] >= 2 && array[j2][1] > array[j1][1]) info[1]++; + } for(j2=0; j2<2; j2++) { if(array[j1+j2][2] <= 1) info[3]++; } - cout << "Paar " << info[3] << endl; + cout << "Paar " << info[1] << "\t" << info[3] << endl; return 0; } } diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index f7e3eb70..93c340da 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -52,7 +52,7 @@ const int maxQuantityPlayersConst = 5; using namespace std; mainWindowImpl::mainWindowImpl(QMainWindow *parent) - : QMainWindow(parent), actualGame(0), actualHand(0), mySession(0), maxQuantityPlayers(maxQuantityPlayersConst), gameSpeed(0), debugMode(0), breakAfterActualHand(FALSE) + : QMainWindow(parent), actualGame(0), actualHand(0), mySession(0), maxQuantityPlayers(maxQuantityPlayersConst), gameSpeed(0), debugMode(1), breakAfterActualHand(FALSE) { int i;