engine 0.4 rev4 (turn part 1)
This commit is contained in:
@@ -674,13 +674,37 @@ void LocalPlayer::flopEngine() {
|
||||
// for(i=0; i<5; i++) cout << tempArray[i] << " ";
|
||||
// cout << endl;
|
||||
|
||||
preflopCardsValue(tempArray);
|
||||
cout << myID << ": ";
|
||||
|
||||
flopCardsValue(tempArray);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void LocalPlayer::turnEngine() {
|
||||
|
||||
ConfigFile myConfig;
|
||||
if(myConfig.readConfigInt("EngineVersion")) {
|
||||
// cout << "Engine 0.3" << endl;
|
||||
|
||||
|
||||
// Prozent ausrechnen
|
||||
|
||||
int i, j, k;
|
||||
@@ -732,12 +756,12 @@ void LocalPlayer::turnEngine() {
|
||||
}
|
||||
|
||||
double percent = (countMy*1.0)/(countAll*1.0);
|
||||
// cout << "Prozent: " << percent << endl;
|
||||
// cout << "Prozent: " << percent << endl;
|
||||
|
||||
Tools myTool;
|
||||
int raise;
|
||||
|
||||
// Bauchgefhl (zufï¿Ålig)
|
||||
// Bauchgefhl (zufï¿Ålig)
|
||||
int tempRand;
|
||||
myTool.getRandNumber((int)(percent*10.)-2,(int)(percent*10.)+2,1,&tempRand,0);
|
||||
|
||||
@@ -745,16 +769,16 @@ void LocalPlayer::turnEngine() {
|
||||
int bluff;
|
||||
myTool.getRandNumber(1,100,1,&bluff,0);
|
||||
|
||||
// cout << "turn-bluff " << bluff << endl;
|
||||
// cout << "turn-bluff " << bluff << endl;
|
||||
|
||||
// Potential
|
||||
// Potential
|
||||
int potential = (10*(5*(int)(percent*100.)+10*tempRand*2))/700-myDude;
|
||||
|
||||
int setToHighest = actualHand->getTurn()->getHighestSet() - mySet;
|
||||
|
||||
// temp fr das Vielfache des Small Blind, sodass HighestSet zu hoch ist
|
||||
int tempFold;
|
||||
// tempFold = (actualHand->getPlayerArray()[0]->getMyAverageSets())/(7*actualHand->getSmallBlind());
|
||||
// tempFold = (actualHand->getPlayerArray()[0]->getMyAverageSets())/(7*actualHand->getSmallBlind());
|
||||
myTool.getRandNumber(3,4,1,&tempFold,0);
|
||||
|
||||
// FOLD
|
||||
@@ -844,9 +868,46 @@ void LocalPlayer::turnEngine() {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// ################### ENGINE 0.4 #################
|
||||
else {
|
||||
// cout << "Engine 0.4" << endl;
|
||||
int tempArray[6];
|
||||
int boardCards[5];
|
||||
int i;
|
||||
|
||||
for(i=0; i<2; i++) tempArray[i] = myCards[i];
|
||||
actualBoard->getMyCards(boardCards);
|
||||
for(i=0; i<4; i++) tempArray[2+i] = boardCards[i];
|
||||
|
||||
// for(i=0; i<5; i++) cout << tempArray[i] << " ";
|
||||
// cout << endl;
|
||||
|
||||
cout << myID << ": ";
|
||||
|
||||
turnCardsValue(tempArray);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void LocalPlayer::riverEngine() {
|
||||
|
||||
// Prozent ausrechnen
|
||||
@@ -1022,7 +1083,7 @@ void LocalPlayer::riverEngine() {
|
||||
|
||||
|
||||
|
||||
int LocalPlayer::preflopCardsValue(int* cards) {
|
||||
int LocalPlayer::flopCardsValue(int* cards) {
|
||||
|
||||
int array[5][3];
|
||||
int j1, j2, j3, j4, k1, k2, ktemp[3];
|
||||
@@ -1161,6 +1222,22 @@ int LocalPlayer::preflopCardsValue(int* cards) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// auf Straight und Full House testen
|
||||
// Straight
|
||||
if((array[0][1]-1 == array[1][1] || array[0][1]-9 == array[1][1] ) && array[1][1]-1 == array[2][1] && array[2][1]-1 == array[3][1] && array[3][1]-1 == array[4][1]) {
|
||||
cout << "Straight" << endl;
|
||||
// -> super Blatt -> auf andere achten
|
||||
return 70;
|
||||
}
|
||||
// Full House
|
||||
if((array[0][1] == array[1][1] && array[0][1] == array[2][1] && array[3][1] == array[4][1]) || (array[2][1] == array[3][1] && array[2][1] == array[4][1] && array[0][1] == array[1][1])) {
|
||||
cout << "Full House" << endl;
|
||||
// -> super Blatt -> auf andere achten
|
||||
return 70;
|
||||
}
|
||||
|
||||
|
||||
// auf Straßenansatz testen
|
||||
for(j1=0; j1<5; j1++) {
|
||||
for(j2=j1+1; j2<5; j2++) {
|
||||
@@ -1199,20 +1276,6 @@ int LocalPlayer::preflopCardsValue(int* cards) {
|
||||
}
|
||||
|
||||
|
||||
// auf Straight und Full House testen
|
||||
// Straight
|
||||
if((array[0][1]-1 == array[1][1] || array[0][1]-9 == array[1][1] ) && array[1][1]-1 == array[2][1] && array[2][1]-1 == array[3][1] && array[3][1]-1 == array[4][1]) {
|
||||
cout << "Straight" << endl;
|
||||
// -> super Blatt -> auf andere achten
|
||||
return 70;
|
||||
}
|
||||
// Full House
|
||||
if((array[0][1] == array[1][1] && array[0][1] == array[2][1] && array[3][1] == array[4][1]) || (array[2][1] == array[3][1] && array[2][1] == array[4][1] && array[0][1] == array[1][1])) {
|
||||
cout << "Full House" << endl;
|
||||
// -> super Blatt -> auf andere achten
|
||||
return 70;
|
||||
}
|
||||
|
||||
// auf Drilling testen
|
||||
for(j1=0; j1<3; j1++) {
|
||||
if(array[j1][1] == array[j1+1][1] && array[j1][1] == array[j1+2][1]) {
|
||||
@@ -1247,3 +1310,263 @@ int LocalPlayer::preflopCardsValue(int* cards) {
|
||||
return 10;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int LocalPlayer::turnCardsValue(int* cards) {
|
||||
|
||||
int array[6][3];
|
||||
int j1, j2, j3, j4, j5, k1, k2, ktemp[3];
|
||||
|
||||
// Kartenwerte umwandeln (z.B. [ 11 (Karo K�ig) -> 0 11 ] oder [ 31 (Pik 7) -> 2 5 ] )
|
||||
for(j1=0; j1<6; j1++) {
|
||||
array[j1][0] = cards[j1]/13;
|
||||
array[j1][1] = cards[j1]%13;
|
||||
array[j1][2] = j1;
|
||||
}
|
||||
|
||||
// Karten nach Farben sortieren: Kreuz - Pik - Herz - Karo
|
||||
for(k1=0; k1<6; k1++) {
|
||||
for(k2=k1+1; k2<6; k2++) {
|
||||
if(array[k1][0]<array[k2][0]) {
|
||||
ktemp[0] = array[k1][0];
|
||||
ktemp[1] = array[k1][1];
|
||||
ktemp[2] = array[k1][2];
|
||||
array[k1][0] = array[k2][0];
|
||||
array[k1][1] = array[k2][1];
|
||||
array[k1][2] = array[k2][2];
|
||||
array[k2][0] = ktemp[0];
|
||||
array[k2][1] = ktemp[1];
|
||||
array[k2][2] = ktemp[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Karten innerhalb der Farben nach der Gr�e sortieren: Ass - K�ig - Dame - ... - 4 - 3 - 2
|
||||
for(k1=0; k1<6; k1++) {
|
||||
for(k2=k1+1; k2<6; k2++) {
|
||||
if(array[k1][0]==array[k2][0] && array[k1][1]<array[k2][1]) {
|
||||
ktemp[0] = array[k1][0];
|
||||
ktemp[1] = array[k1][1];
|
||||
ktemp[2] = array[k1][2];
|
||||
array[k1][0] = array[k2][0];
|
||||
array[k1][1] = array[k2][1];
|
||||
array[k1][2] = array[k2][2];
|
||||
array[k2][0] = ktemp[0];
|
||||
array[k2][1] = ktemp[1];
|
||||
array[k2][2] = ktemp[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auf Straight Flush und Flush testen
|
||||
// 5 Karten gleiche Farbe ?
|
||||
for(j1=0; j1<2; j1++) {
|
||||
// 5 Karten gleiche Farbe ?
|
||||
if(array[j1][0] == array[j1+1][0] && array[j1][0] == array[j1+2][0] && array[j1][0] == array[j1+3][0] && array[j1][0] == array[j1+4][0]) {
|
||||
// Straight Flush?
|
||||
if(array[j1][1]-4 == array[j1+4][1]) {
|
||||
cout << "Straight Flush" << endl;
|
||||
// -> Sieg -> alles mitgehen
|
||||
return 100;
|
||||
}
|
||||
else {
|
||||
// Straight Flush Ausnahme: 5-4-3-2-A
|
||||
for(j2=j1+1; j2<3; j2++) {
|
||||
if(array[j1][1]-9==array[j2][1] && array[j2][1]-1==array[j2+1][1] && array[j2+1][1]-1==array[j2+2][1] && array[j2+2][1]-1==array[j2+3][1] && array[j1][0]==array[j2+2][0] && array[j1][0]==array[j2+3][0]) {
|
||||
cout << "Straight Flush Ass unten" << endl;
|
||||
// -> fast sicherer Sieg -> alles mitgehen
|
||||
return 99;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auf Flush testen
|
||||
for(j1=0; j1<2; j1++) {
|
||||
if(array[j1][0] == array[j1+1][0] && array[j1][0] == array[j1+2][0] && array[j1][0] == array[j1+3][0] && array[j1][0] == array[j1+4][0]) {
|
||||
cout << "Flush" << endl;
|
||||
// -> sehr gutes Blatt -> eigenen Anteil ermitteln und auf andere achten
|
||||
return 70;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// auf Straight Flush Draw und Flush Draw testen
|
||||
for(j1=0; j1<3; j1++) {
|
||||
// 4 Karten gleiche Farbe ?
|
||||
if(array[j1][0] == array[j1+1][0] && array[j1][0] == array[j1+2][0] && array[j1][0] == array[j1+3][0]) {
|
||||
// zusammenhaengender Strassenansatz ?
|
||||
if(array[j1][1]-3 == array[j1+3][1]) {
|
||||
// Strassenansatz am Rand?
|
||||
if(array[j1][1] == 12) {
|
||||
cout << "zusammenhaengender Straight-Flush-Draw mit Ass high ";
|
||||
break;
|
||||
}
|
||||
// Strassenansatz in der Mitte
|
||||
else {
|
||||
cout << "zusammenhaengender Straight-Flush-Draw in der Mitte ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Bauchschuss ?
|
||||
if(array[j1][1]-4 == array[j1+3][1]) {
|
||||
cout << "Straight-Flush-Bauchschuss ";
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// Test auf Straight-Flush-Ausnahme 5-4-3-2-A
|
||||
if(array[j1][1] == 12 && (array[j1+1][1]<=3 || (array[j1+2][1]<=3 && array[j1][0]==array[j1+4][0]) || (array[j1+3][1]<=3 && array[j1][0]==array[j1+4][0] && array[j1][0]==array[j1+4][0]))) {
|
||||
cout << "Straight-Flush-Draw Ass unten ";
|
||||
break;
|
||||
}
|
||||
// Flush Draw
|
||||
else {
|
||||
cout << "Flush Draw ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Karten fr den Vierling-, Full-House-, Drilling- und Paartest umsortieren
|
||||
for(k1=0; k1<6; k1++) {
|
||||
for(k2=k1+1; k2<6; k2++) {
|
||||
if(array[k1][1]<array[k2][1]) {
|
||||
ktemp[0] = array[k1][0];
|
||||
ktemp[1] = array[k1][1];
|
||||
ktemp[2] = array[k1][2];
|
||||
array[k1][0] = array[k2][0];
|
||||
array[k1][1] = array[k2][1];
|
||||
array[k1][2] = array[k2][2];
|
||||
array[k2][0] = ktemp[0];
|
||||
array[k2][1] = ktemp[1];
|
||||
array[k2][2] = ktemp[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auf Vierling testen
|
||||
for(j1=0; j1<3; j1++) {
|
||||
if(array[j1][1] == array[j1+1][1] && array[j1][1] == array[j1+2][1] && array[j1][1] == array[j1+3][1]) {
|
||||
cout << "Vierling" << endl;
|
||||
// -> Sieg (nur von Sraight Flush schlagbar) -> alles mitgehn
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// auf Straight und Full House testen
|
||||
for(j1=0; j1<6; j1++) {
|
||||
for(j2=j1+1; j2<6; j2++) {
|
||||
for(j3=j2+1; j3<6; j3++) {
|
||||
for(j4=j3+1; j4<6; j4++) {
|
||||
for(j5=j4+1; j5<6; j5++) {
|
||||
// Straight
|
||||
if((array[j1][1]-1 == array[j2][1] || array[j1][1]-9 == array[j2][1] ) && array[j2][1]-1 == array[j3][1] && array[j3][1]-1 == array[j4][1] && array[j4][1]-1 == array[j5][1]) {
|
||||
cout << "Straight" << endl;
|
||||
// -> super Blatt -> auf andere achten
|
||||
return 70;
|
||||
}
|
||||
// Full House
|
||||
if((array[j1][1] == array[j2][1] && array[j1][1] == array[j3][1] && array[j4][1] == array[j5][1]) || (array[j3][1] == array[j4][1] && array[j3][1] == array[j5][1] && array[j1][1] == array[j2][1])) {
|
||||
cout << "Full House" << endl;
|
||||
// -> super Blatt -> auf andere achten
|
||||
return 70;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auf Straßenansatz testen
|
||||
for(j1=0; j1<6; j1++) {
|
||||
for(j2=j1+1; j2<6; j2++) {
|
||||
for(j3=j2+1; j3<6; j3++) {
|
||||
for(j4=j3+1; j4<6; j4++) {
|
||||
// zusammenhaengender Strassenansatz ?
|
||||
if(array[j1][1]-1 == array[j2][1] && array[j2][1]-1 == array[j3][1] && array[j3][1]-1 == array[j4][1]) {
|
||||
// Strassenansatz am Rand?
|
||||
if(array[j1][1] == 12) {
|
||||
cout << "zusammenhaengender Straight-Draw mit Ass high ";
|
||||
break;
|
||||
}
|
||||
// Strassenansatz in der Mitte
|
||||
else {
|
||||
cout << "zusammenhaengender Straight-Draw in der Mitte ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Bauchschuss ?
|
||||
if((array[j1][1]-2 == array[j2][1] && array[j2][1]-1 == array[j3][1] && array[j3][1]-1 == array[j4][1]) || (array[j1][1]-1 == array[j2][1] && array[j2][1]-2 == array[j3][1] && array[j3][1]-1 == array[j4][1]) || (array[j1][1]-1 == array[j2][1] && array[j2][1]-1 == array[j3][1] && array[j3][1]-2 == array[j4][1])) {
|
||||
cout << "Straight-Bauchschuss ";
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// Test auf Straßenansatz-Ausnahme 5-4-3-2-A
|
||||
if((array[j1][1]-9 == array[j2][1] && array[j2][1]-1 == array[j3][1] && array[j3][1]-1 == array[j4][1]) || (array[j1][1]-9 == array[j2][1] && array[j2][1]-1 == array[j3][1] && array[j3][1]-2 == array[j4][1]) || (array[j1][1]-9 == array[j2][1] && array[j2][1]-2 == array[j3][1] && array[j3][1]-1 == array[j4][1]) || (array[j1][1]-10 == array[j2][1] && array[j2][1]-1 == array[j3][1] && array[j3][1]-1 == array[j4][1])) {
|
||||
cout << "Straight-Draw Ass unten ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// auf Drilling testen
|
||||
for(j1=0; j1<4; j1++) {
|
||||
if(array[j1][1] == array[j1+1][1] && array[j1][1] == array[j1+2][1]) {
|
||||
cout << "Drilling" << endl;
|
||||
// -> gutes Blatt -> eigenen Anteil ermitteln und auf andere achten
|
||||
return 50;
|
||||
}
|
||||
}
|
||||
|
||||
// auf Zwei Paare testen
|
||||
for(j1=0; j1<3; j1++) {
|
||||
for(j2=j1+2; j2<5; j2++) {
|
||||
if(array[j1][1] == array[j1+1][1] && array[j2][1] == array[j2+1][1]) {
|
||||
cout << "Zwei Paare" << endl;
|
||||
// -> gutes Blatt -> eigenen Anteil ermitteln und auf andere achten
|
||||
return 40;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auf Paar testen
|
||||
for(j1=0; j1<5; j1++) {
|
||||
if(array[j1][1] == array[j1+1][1]) {
|
||||
cout << "Paar" << endl;
|
||||
// -> gutes Blatt -> eigenen Anteil ermitteln und auf andere achten
|
||||
return 30;
|
||||
}
|
||||
}
|
||||
|
||||
// Highest Card (Klasse 0) + Kicker
|
||||
cout << endl;
|
||||
return 10;
|
||||
|
||||
}
|
||||
|
||||
@@ -94,7 +94,8 @@ public:
|
||||
void turnEngine();
|
||||
void riverEngine();
|
||||
|
||||
int preflopCardsValue(int*);
|
||||
int flopCardsValue(int*);
|
||||
int turnCardsValue(int*);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user