Merge branch 'master' of github.com:/pokerth/pokerth into gocode
This commit is contained in:
@@ -255,7 +255,7 @@ int CardsValue::cardsValueShort(int cards[4])
|
||||
|
||||
// Royal Flush, Straight Flush, Flush
|
||||
for(color_idx=0; color_idx<4; color_idx++) { // check all colors
|
||||
if(Tools::bitcount(cards[color_idx])>=5) { // check if at least 5 cards of one color
|
||||
if(bitcount(cards[color_idx])>=5) { // check if at least 5 cards of one color
|
||||
if((cards[color_idx] & straight[0]) == straight[0]) // check for Royal Flush
|
||||
return 9;
|
||||
else { // check for Straight Flush
|
||||
@@ -293,7 +293,7 @@ int CardsValue::cardsValueShort(int cards[4])
|
||||
for(color_2_idx=color_1_idx+1; color_2_idx<3; color_2_idx++) {
|
||||
for(color_3_idx=color_2_idx+1; color_3_idx<4; color_3_idx++) {
|
||||
temp = cards[color_1_idx] & cards[color_2_idx] & cards[color_3_idx];
|
||||
if(Tools::bitcount(temp) == 2) { // two times Three of a Kind
|
||||
if(bitcount(temp) == 2) { // two times Three of a Kind
|
||||
return 6; // Full House
|
||||
} else {
|
||||
if(temp) {
|
||||
@@ -315,7 +315,7 @@ int CardsValue::cardsValueShort(int cards[4])
|
||||
for(color_1_idx=0; color_1_idx<3; color_1_idx++) {
|
||||
for(color_2_idx=color_1_idx+1; color_2_idx<4; color_2_idx++) {
|
||||
temp = cards[color_1_idx] & cards[color_2_idx];
|
||||
if(Tools::bitcount(temp) >= 2) { // at least two times Two of a Kind
|
||||
if(bitcount(temp) >= 2) { // at least two times Two of a Kind
|
||||
return 2; // Two Pairs
|
||||
} else {
|
||||
if(temp) { // search for second pair
|
||||
@@ -343,7 +343,7 @@ int CardsValue::cardsValue(int cards[4], int bestHand[4])
|
||||
|
||||
// Royal Flush, Straight Flush, Flush
|
||||
for(color_1_idx=0; color_1_idx<4; color_1_idx++) { // check all colors
|
||||
if(Tools::bitcount(cards[color_1_idx])>=5) { // check if at least 5 cards of one color
|
||||
if(bitcount(cards[color_1_idx])>=5) { // check if at least 5 cards of one color
|
||||
if((cards[color_1_idx] & straight[0]) == straight[0]) { // check for Royal Flush
|
||||
if(bestHand) bestHand[color_1_idx] = straight[0];
|
||||
return 900000000; // Royal Flush
|
||||
@@ -396,7 +396,6 @@ int CardsValue::cardsValue(int cards[4], int bestHand[4])
|
||||
}
|
||||
|
||||
int color_2_idx, color_3_idx;
|
||||
int temp2;
|
||||
|
||||
// Full House, Three of a Kind
|
||||
temp1 = 0;
|
||||
@@ -408,12 +407,12 @@ int CardsValue::cardsValue(int cards[4], int bestHand[4])
|
||||
}
|
||||
}
|
||||
if(temp1) {
|
||||
if(Tools::bitcount(temp1) == 2) {
|
||||
if(bitcount(temp1) == 2) {
|
||||
// two times Three of a Kind
|
||||
if(bestHand) {
|
||||
kickerValue1 = determineKickerValue(temp1,0,0);
|
||||
kickerValue2 = determineKickerValue(kickerValue1.remain,1,1);
|
||||
temp2 = 0;
|
||||
int temp2 = 0;
|
||||
for(color_1_idx=3; color_1_idx>=0; color_1_idx--) {
|
||||
if(temp2<2) bestHand[color_1_idx] += (cards[color_1_idx] & (kickerValue1.select | kickerValue2.select));
|
||||
else bestHand[color_1_idx] += (cards[color_1_idx] & kickerValue1.select);
|
||||
@@ -423,7 +422,7 @@ int CardsValue::cardsValue(int cards[4], int bestHand[4])
|
||||
return 600000000 + determineKickerValue(temp1,0,1).factorValue;
|
||||
} else {
|
||||
// one times Three of a Kind
|
||||
temp2 = temp1;
|
||||
int temp2 = temp1;
|
||||
temp1 = 0;
|
||||
// check for additional pair
|
||||
for(color_1_idx=0; color_1_idx<3; color_1_idx++) {
|
||||
@@ -460,7 +459,7 @@ int CardsValue::cardsValue(int cards[4], int bestHand[4])
|
||||
}
|
||||
}
|
||||
if(temp1) {
|
||||
if(Tools::bitcount(temp1) >= 2) { // at least two times Two of a Kind
|
||||
if(bitcount(temp1) >= 2) { // at least two times Two of a Kind
|
||||
kickerValue1 = determineKickerValue(temp1,0,1);
|
||||
kickerValue2 = determineKickerValue(OR & ~kickerValue1.select,2,2);
|
||||
if(bestHand) {
|
||||
@@ -518,389 +517,8 @@ KickerValue CardsValue::determineKickerValue(int testValue, int factorPointerSta
|
||||
return kickerValue;
|
||||
}
|
||||
|
||||
int CardsValue::cardsValueOld(int cards[7], int position[5])
|
||||
{
|
||||
|
||||
int array[7][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<7; 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<7; k1++) {
|
||||
for(k2=k1+1; k2<7; 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<7; k1++) {
|
||||
for(k2=k1+1; k2<7; 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Karten auf Bl�ter testen. Klasseneinteilung absteigend: 9 - Royal Flush, 8 - Straight Flush, ... 2 - Zwei Paare, 1 - Ein Paar, 0 - Nischt
|
||||
|
||||
// auf Royal Flush (Klasse 9) und Straight Flush (Klasse 8) testen
|
||||
for(j1=0; j1<3; 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]) {
|
||||
// zus�zlich in Stra�nform ?
|
||||
if(array[j1][1]-1 == array[j1+1][1] && array[j1+1][1]-1 == array[j1+2][1] && array[j1+2][1]-1 == array[j1+3][1] && array[j1+3][1]-1 == array[j1+4][1]) {
|
||||
// mit Ass an der Spitze ?
|
||||
if(array[j1][1] == 12) {
|
||||
// Royal Flush (9*100000000)
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<5; j2++) {
|
||||
position[j2] = array[j1+j2][2];
|
||||
}
|
||||
}
|
||||
return 900000000;
|
||||
}
|
||||
// sonst nur Straight Flush (8*100000000 + (h�hste Straight-Karte)*1000000)
|
||||
else {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<5; j2++) {
|
||||
position[j2] = array[j1+j2][2];
|
||||
}
|
||||
}
|
||||
return 800000000+array[j1][1]*1000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Straight Flush Ausnahme: 5-4-3-2-A
|
||||
for(j1=0; j1<3; 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]) {
|
||||
for(j2=j1+1; j2<4; 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]) {
|
||||
// Straight Flush mit 5 als höchste Karte -> 8*100000000+3*1000000
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
position[0] = array[j1][2];
|
||||
for(j3=0; j3<4; j3++) {
|
||||
position[j3+1] = array[j2+j3][2];
|
||||
}
|
||||
}
|
||||
return 800000000+3*1000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auf Flush (Klasse 5) testen
|
||||
for(j1=0; j1<3; 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]) {
|
||||
// Flush -> 5*10000000 + h�ste Flush Karten mit absteigender Wertung
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<5; j2++) {
|
||||
position[j2] = array[j1+j2][2];
|
||||
}
|
||||
}
|
||||
return 500000000+array[j1][1]*1000000+array[j1+1][1]*10000+array[j1+2][1]*100+array[j1+3][1]*10+array[j1+4][1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Karten fr den Vierling-, Full-House-, Drilling- und Paartest umsortieren
|
||||
for(k1=0; k1<7; k1++) {
|
||||
for(k2=k1+1; k2<7; 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// nach Position sortieren: erst board, dann hole cards
|
||||
for(k1=0; k1<7; k1++) {
|
||||
for(k2=k1+1; k2<7; k2++) {
|
||||
if(array[k1][1]==array[k2][1] && array[k1][2]<array[k2][2]) {
|
||||
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 (Klasse 7) testen
|
||||
for(j1=0; j1<4; j1++) {
|
||||
if(array[j1][1] == array[j1+1][1] && array[j1][1] == array[j1+2][1] && array[j1][1] == array[j1+3][1]) {
|
||||
// Position des Kickers ermitteln und der Blattwertung als dritte Gewichtung hinzuaddieren
|
||||
if(j1==0) {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<5; j2++) {
|
||||
position[j2] = array[j2][2];
|
||||
}
|
||||
}
|
||||
return 700000000+array[j1][1]*1000000+array[j1+4][1]*10000;
|
||||
} else {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<4; j2++) {
|
||||
position[j2] = array[j1+j2][2];
|
||||
}
|
||||
position[4] = array[0][2];
|
||||
}
|
||||
return 700000000+array[j1][1]*1000000+array[0][1]*10000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hilfsvariablen fr die Full-House-Paar- und -Drilling-Zuordnung
|
||||
int drei, zwei;
|
||||
|
||||
// auf Straight (Klasse 4) und Full House (Klasse 6) testen
|
||||
for(j1=0; j1<7; j1++) {
|
||||
for(j2=j1+1; j2<7; j2++) {
|
||||
for(j3=j2+1; j3<7; j3++) {
|
||||
for(j4=j3+1; j4<7; j4++) {
|
||||
for(j5=j4+1; j5<7; j5++) {
|
||||
// Straight
|
||||
if(array[j1][1]-1 == array[j2][1] && array[j2][1]-1 == array[j3][1] && array[j3][1]-1 == array[j4][1] && array[j4][1]-1 == array[j5][1]) {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
position[0] = array[j1][2];
|
||||
position[1] = array[j2][2];
|
||||
position[2] = array[j3][2];
|
||||
position[3] = array[j4][2];
|
||||
position[4] = array[j5][2];
|
||||
}
|
||||
return 400000000+array[j1][1]*1000000;
|
||||
}
|
||||
// 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])) {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
position[0] = array[j1][2];
|
||||
position[1] = array[j2][2];
|
||||
position[2] = array[j3][2];
|
||||
position[3] = array[j4][2];
|
||||
position[4] = array[j5][2];
|
||||
}
|
||||
// Paar und Drilling des Full House ermitteln ermitteln
|
||||
if(array[j3][1]==array[j1][1]) {
|
||||
drei = array[j1][1];
|
||||
zwei = array[j4][1];
|
||||
} else {
|
||||
drei = array[j4][1];
|
||||
zwei = array[j1][1];
|
||||
}
|
||||
return 600000000+drei*1000000+zwei*10000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auf Straight-Spezialfall ( 5 4 3 2 A ) testen
|
||||
for(j1=0; j1<7; j1++) {
|
||||
for(j2=j1+1; j2<7; j2++) {
|
||||
for(j3=j2+1; j3<7; j3++) {
|
||||
for(j4=j3+1; j4<7; j4++) {
|
||||
for(j5=j4+1; j5<7; j5++) {
|
||||
if(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]) {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
position[0] = array[j1][2];
|
||||
position[1] = array[j2][2];
|
||||
position[2] = array[j3][2];
|
||||
position[3] = array[j4][2];
|
||||
position[4] = array[j5][2];
|
||||
}
|
||||
return 400000000+array[j2][1]*1000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auf Drilling (Klasse 3) testen
|
||||
for(j1=0; j1<5; j1++) {
|
||||
if(array[j1][1] == array[j1+1][1] && array[j1][1] == array[j1+2][1]) {
|
||||
// Kicker ermitteln
|
||||
if(j1==0) {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<5; j2++) {
|
||||
position[j2] = array[j2][2];
|
||||
}
|
||||
}
|
||||
return 300000000+array[j1][1]*1000000+array[j1+3][1]*10000+array[j1+4][1]*100;
|
||||
} else {
|
||||
if(j1==1) {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<5; j2++) {
|
||||
position[j2] = array[j2][2];
|
||||
}
|
||||
}
|
||||
return 300000000+array[j1][1]*1000000+array[j1-1][1]*10000+array[j1+3][1]*100;
|
||||
} else {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<3; j2++) {
|
||||
position[j2] = array[j1+j2][2];
|
||||
}
|
||||
position[3] = array[0][2];
|
||||
position[4] = array[1][2];
|
||||
}
|
||||
return 300000000+array[j1][1]*1000000+array[0][1]*10000+array[1][1]*100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auf Zwei Paare (Klasse 2) testen
|
||||
for(j1=0; j1<4; j1++) {
|
||||
for(j2=j1+2; j2<6; j2++) {
|
||||
if(array[j1][1] == array[j1+1][1] && array[j2][1] == array[j2+1][1]) {
|
||||
// Kicker ermitteln
|
||||
if(j1==0) {
|
||||
if(j2==2) {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
position[0] = array[j1][2];
|
||||
position[1] = array[j1+1][2];
|
||||
position[2] = array[j2][2];
|
||||
position[3] = array[j2+1][2];
|
||||
position[4] = array[j2+2][2];
|
||||
}
|
||||
return 200000000+array[j1][1]*1000000+array[j2][1]*10000+array[j2+2][1]*100;
|
||||
} else {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
position[0] = array[j1][2];
|
||||
position[1] = array[j1+1][2];
|
||||
position[2] = array[j2][2];
|
||||
position[3] = array[j2+1][2];
|
||||
position[4] = array[j1+2][2];
|
||||
}
|
||||
return 200000000+array[j1][1]*1000000+array[j2][1]*10000+array[j1+2][1]*100;
|
||||
}
|
||||
} else {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
position[0] = array[j1][2];
|
||||
position[1] = array[j1+1][2];
|
||||
position[2] = array[j2][2];
|
||||
position[3] = array[j2+1][2];
|
||||
position[4] = array[0][2];
|
||||
}
|
||||
return 200000000+array[j1][1]*1000000+array[j2][1]*10000+array[0][1]*100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auf Paar (Klasse 1) testen
|
||||
for(j1=0; j1<6; j1++) {
|
||||
if(array[j1][1] == array[j1+1][1]) {
|
||||
// Kicker ermitteln
|
||||
if(j1==0) {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<5; j2++) {
|
||||
position[j2] = array[j2][2];
|
||||
}
|
||||
}
|
||||
return 100000000+array[j1][1]*1000000+array[j1+2][1]*10000+array[j1+3][1]*100+array[j1+4][1];
|
||||
}
|
||||
if(j1==1) {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<5; j2++) {
|
||||
position[j2] = array[j2][2];
|
||||
}
|
||||
}
|
||||
return 100000000+array[j1][1]*1000000+array[j1-1][1]*10000+array[j1+2][1]*100+array[j1+3][1];
|
||||
}
|
||||
if(j1==2) {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<5; j2++) {
|
||||
position[j2] = array[j2][2];
|
||||
}
|
||||
}
|
||||
return 100000000+array[j1][1]*1000000+array[j1-2][1]*10000+array[j1-1][1]*100+array[j1+2][1];
|
||||
} else {
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<2; j2++) {
|
||||
position[j2] = array[j1+j2][2];
|
||||
}
|
||||
position[2] = array[0][2];
|
||||
position[3] = array[1][2];
|
||||
position[4] = array[2][2];
|
||||
}
|
||||
return 100000000+array[j1][1]*1000000+array[0][1]*10000+array[1][1]*100+array[2][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Highest Card (Klasse 0) + Kicker
|
||||
if(position) {
|
||||
// Position-Array fuellen
|
||||
for(j2=0; j2<5; j2++) {
|
||||
position[j2] = array[j2][2];
|
||||
}
|
||||
}
|
||||
return array[0][1]*1000000+array[1][1]*10000+array[2][1]*100+array[3][1]*10+array[4][1];
|
||||
}
|
||||
|
||||
|
||||
std::vector< std::vector<int> > CardsValue::calcCardsChance(GameState beRoID, int playerCards[2], int boardCards[5])
|
||||
{
|
||||
int card_idx_1, card_idx_2;
|
||||
|
||||
std::vector< std::vector<int> > chance(2);
|
||||
chance[0].assign(10,0);
|
||||
chance[1].assign(10,0);
|
||||
@@ -908,6 +526,7 @@ std::vector< std::vector<int> > CardsValue::calcCardsChance(GameState beRoID, in
|
||||
int cards[4] = { 0,0,0,0 };
|
||||
int sum = 0;
|
||||
|
||||
int card_idx_1;
|
||||
for(card_idx_1=0; card_idx_1<2; card_idx_1++) cards[playerCards[card_idx_1]/13] |= (1 << (playerCards[card_idx_1]%13));
|
||||
|
||||
switch(beRoID) {
|
||||
@@ -924,7 +543,7 @@ std::vector< std::vector<int> > CardsValue::calcCardsChance(GameState beRoID, in
|
||||
for(card_idx_1=0; card_idx_1<51; card_idx_1++) {
|
||||
if((cards[card_idx_1/13] & (1 << (card_idx_1%13))) == 0) {
|
||||
cards[card_idx_1/13] |= (1 << (card_idx_1%13));
|
||||
for(card_idx_2=card_idx_1+1; card_idx_2<52; card_idx_2++) {
|
||||
for(int card_idx_2=card_idx_1+1; card_idx_2<52; card_idx_2++) {
|
||||
if((cards[card_idx_2/13] & (1 << (card_idx_2%13))) == 0) {
|
||||
cards[card_idx_2/13] |= (1 << (card_idx_2%13));
|
||||
(chance[0][cardsValueShort(cards)])++;
|
||||
@@ -2574,6 +2193,44 @@ std::list<std::string> CardsValue::translateCardsValueCode(int cardsValueCode)
|
||||
|
||||
}
|
||||
|
||||
int CardsValue::bitcount(int in)
|
||||
{
|
||||
int count=0 ;
|
||||
while (in) {
|
||||
count++ ;
|
||||
in &= (in - 1) ;
|
||||
|
||||
}
|
||||
return count ;
|
||||
}
|
||||
|
||||
int
|
||||
CardsValue::bestHandToPosition(int bestHand[4], int cardArray[7], int position[5])
|
||||
{
|
||||
|
||||
for(int card_idx=0; card_idx<5; card_idx++) position[card_idx] = -1;
|
||||
|
||||
int position_ctr = 0;
|
||||
for(int color_idx=0; color_idx<4; color_idx++) {
|
||||
for(int card_idx_1=0; card_idx_1<13; card_idx_1++) {
|
||||
if(bestHand[color_idx] & (1<<card_idx_1)) {
|
||||
for(int card_idx_2=0; card_idx_2<7; card_idx_2++) {
|
||||
if(cardArray[card_idx_2] == color_idx*13+card_idx_1) {
|
||||
if(position_ctr<5) {
|
||||
position[position_ctr] = card_idx_2;
|
||||
position_ctr++;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(position_ctr!=5) return 0;
|
||||
else return 1;
|
||||
}
|
||||
|
||||
|
||||
//int** CardsValue::showdown(GameState beRoID, int** playerCards, int playerCount) {
|
||||
//
|
||||
|
||||
@@ -49,15 +49,17 @@ class CardsValue
|
||||
public:
|
||||
static int holeCardsClass(int, int);
|
||||
static int cardsValueShort(int[4]);
|
||||
static int cardsValue(int[4], int[4]);
|
||||
static int cardsValue(int[4], int[4] = 0);
|
||||
static KickerValue determineKickerValue(int, int, int);
|
||||
static int cardsValueOld(int[7], int[5]);
|
||||
static std::string determineHandName(int myCardsValueInt, PlayerList activePlayerList);
|
||||
static std::list<std::string> translateCardsValueCode(int cardsValueCode);
|
||||
|
||||
static int holeCardsToIntCode(int[2]);
|
||||
|
||||
static std::vector< std::vector<int> > calcCardsChance(GameState, int[2], int[5]);
|
||||
|
||||
static int bitcount(int in);
|
||||
static int bestHandToPosition(int bestHand[4], int cardArray[7], int position[5]);
|
||||
//static int** showdown(GameState, int**, int);
|
||||
|
||||
};
|
||||
|
||||
@@ -147,26 +147,26 @@ void LocalBeRo::run()
|
||||
//log the turned cards
|
||||
if(!logBoardCardsDone) {
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
int boardCards[5];
|
||||
|
||||
myHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
myHand->getBoard()->getMyCards(boardCards);
|
||||
|
||||
switch(myBeRoID) {
|
||||
case GAME_STATE_FLOP:
|
||||
myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2]);
|
||||
myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, boardCards[0], boardCards[1], boardCards[2]);
|
||||
break;
|
||||
case GAME_STATE_TURN:
|
||||
myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3]);
|
||||
myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, boardCards[0], boardCards[1], boardCards[2], boardCards[3]);
|
||||
break;
|
||||
case GAME_STATE_RIVER:
|
||||
myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]);
|
||||
myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, boardCards[0], boardCards[1], boardCards[2], boardCards[3], boardCards[4]);
|
||||
|
||||
break;
|
||||
default: {
|
||||
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR - wrong myBeRoID");
|
||||
}
|
||||
}
|
||||
if(myHand->getLog()) myHand->getLog()->logBoardCards(tempBoardCardsArray);
|
||||
if(myHand->getLog()) myHand->getLog()->logBoardCards(boardCards);
|
||||
logBoardCardsDone = true;
|
||||
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
||||
|
||||
// generate cards and assign to board and player
|
||||
const int NumCards = 52;
|
||||
int cardsArray[NumCards] = {
|
||||
int cards[NumCards] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||
@@ -66,49 +66,50 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
|
||||
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
||||
50, 51
|
||||
};
|
||||
Tools::ShuffleArrayNonDeterministic(cardsArray, NumCards);
|
||||
int tempBoardArray[5];
|
||||
int tempPlayerArray[2];
|
||||
int tempPlayerAndBoardArray[7];
|
||||
int bestHandPos[5];
|
||||
Tools::ShuffleArrayNonDeterministic(cards, NumCards);
|
||||
int boardCards[5];
|
||||
int playerHoleCards[2];
|
||||
int playerCards[7];
|
||||
int sBluff;
|
||||
|
||||
// board cards
|
||||
for(i=0; i<5; i++) tempBoardArray[i] = cardsArray[i];
|
||||
for(i=0; i<5; i++) boardCards[i] = cards[i];
|
||||
|
||||
// debug mode
|
||||
if(myLog) myLog->debugMode_getBoardCards(tempBoardArray,myID);
|
||||
if(myLog) myLog->debugMode_getBoardCards(boardCards,myID);
|
||||
|
||||
// prepare whole player hand
|
||||
for(i=0; i<5; i++) tempPlayerAndBoardArray[i+2] = tempBoardArray[i];
|
||||
for(i=0; i<5; i++) playerCards[i+2] = boardCards[i];
|
||||
|
||||
k = 0;
|
||||
myBoard->setMyCards(tempBoardArray);
|
||||
myBoard->setMyCards(boardCards);
|
||||
for(it=activePlayerList->begin(); it!=activePlayerList->end(); ++it, k++) {
|
||||
|
||||
(*it)->getMyBestHandPosition(bestHandPos);
|
||||
|
||||
// hole cards
|
||||
for(j=0; j<2; j++) tempPlayerArray[j] = cardsArray[2*k+j+5];
|
||||
|
||||
// debug mode
|
||||
if(myLog) myLog->debugMode_getPlayerCards(tempPlayerArray,myID,k);
|
||||
for(j=0; j<2; j++) playerHoleCards[j] = cards[2*k+j+5];
|
||||
(*it)->setMyHoleCards(playerHoleCards);
|
||||
if(myLog) myLog->debugMode_getPlayerCards(playerHoleCards,myID,k); // debug mode
|
||||
|
||||
// complete whole player hand
|
||||
for(j=0; j<2; j++) tempPlayerAndBoardArray[j] = tempPlayerArray[j];
|
||||
for(j=0; j<2; j++) playerCards[j] = playerHoleCards[j];
|
||||
|
||||
(*it)->setMyHoleCards(tempPlayerArray);
|
||||
(*it)->setMyCardsValueInt(CardsValue::cardsValueOld(tempPlayerAndBoardArray, bestHandPos));
|
||||
(*it)->setMyBestHandPosition(bestHandPos);
|
||||
(*it)->setMyRoundStartCash((*it)->getMyCash());
|
||||
// determine cards value
|
||||
int bestHand[4] = { 0,0,0,0 };
|
||||
int playerCardsColor[4] = { 0,0,0,0 };
|
||||
for(j=0; j<7; j++) playerCardsColor[playerCards[j]/13] |= (1 << playerCards[j]%13);
|
||||
(*it)->setMyCardsValueInt(CardsValue::cardsValue(playerCardsColor,bestHand));
|
||||
|
||||
// error-check
|
||||
for(j=0; j<5; j++) {
|
||||
if (bestHandPos[j] == -1) {
|
||||
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR getMyBestHandPosition");
|
||||
}
|
||||
// determine position of best 5 cards
|
||||
int bestHandPos[5];
|
||||
if(CardsValue::bestHandToPosition(bestHand,playerCards,bestHandPos)) {
|
||||
(*it)->setMyBestHandPosition(bestHandPos);
|
||||
} else {
|
||||
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR getMyBestHandPosition");
|
||||
}
|
||||
|
||||
// set round start cash
|
||||
(*it)->setMyRoundStartCash((*it)->getMyCash());
|
||||
|
||||
// set sBluff for all players --> TODO for ai-player in internet
|
||||
if((*it)->getMyID() != 0) {
|
||||
Tools::GetRand(1, 100, 1, &sBluff);
|
||||
@@ -158,20 +159,19 @@ void LocalHand::start()
|
||||
void LocalHand::assignButtons()
|
||||
{
|
||||
|
||||
size_t i;
|
||||
PlayerListIterator it;
|
||||
PlayerListIterator seatIt;
|
||||
|
||||
// delete all buttons
|
||||
for (it=seatsList->begin(); it!=seatsList->end(); ++it) {
|
||||
(*it)->setMyButton(BUTTON_NONE);
|
||||
for (seatIt=seatsList->begin(); seatIt!=seatsList->end(); ++seatIt) {
|
||||
(*seatIt)->setMyButton(BUTTON_NONE);
|
||||
}
|
||||
|
||||
// assign dealer button
|
||||
it = getSeatIt(dealerPosition);
|
||||
if(it == seatsList->end()) {
|
||||
seatIt = getSeatIt(dealerPosition);
|
||||
if(seatIt == seatsList->end()) {
|
||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
||||
}
|
||||
(*it)->setMyButton(BUTTON_DEALER);
|
||||
(*seatIt)->setMyButton(BUTTON_DEALER);
|
||||
|
||||
|
||||
// assign Small Blind next to dealer. ATTENTION: in heads up it is big blind
|
||||
@@ -182,40 +182,40 @@ void LocalHand::assignButtons()
|
||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
||||
}
|
||||
|
||||
for(i=0; i<seatsList->size(); i++) {
|
||||
for(size_t i=0; i<seatsList->size(); i++) {
|
||||
|
||||
++dealerPositionIt;
|
||||
if(dealerPositionIt == seatsList->end()) dealerPositionIt = seatsList->begin();
|
||||
|
||||
it = getActivePlayerIt( (*dealerPositionIt)->getMyUniqueID() );
|
||||
if(it != activePlayerList->end() ) {
|
||||
PlayerListIterator activePlayerIt = getActivePlayerIt( (*dealerPositionIt)->getMyUniqueID() );
|
||||
if(activePlayerIt != activePlayerList->end() ) {
|
||||
nextActivePlayerFound = true;
|
||||
if(activePlayerList->size() > 2) {
|
||||
//small blind normal
|
||||
(*it)->setMyButton(2);
|
||||
smallBlindPosition = (*it)->getMyUniqueID();
|
||||
(*activePlayerIt)->setMyButton(2);
|
||||
smallBlindPosition = (*activePlayerIt)->getMyUniqueID();
|
||||
} else {
|
||||
//big blind in heads up
|
||||
(*it)->setMyButton(3);
|
||||
bigBlindPosition = (*it)->getMyUniqueID();
|
||||
(*activePlayerIt)->setMyButton(3);
|
||||
bigBlindPosition = (*activePlayerIt)->getMyUniqueID();
|
||||
// lastPlayerAction for showing cards
|
||||
}
|
||||
|
||||
// first player after dealer have to show his cards first (in showdown)
|
||||
lastActionPlayerID = (*it)->getMyUniqueID();
|
||||
lastActionPlayerID = (*activePlayerIt)->getMyUniqueID();
|
||||
myBoard->setLastActionPlayerID(lastActionPlayerID);
|
||||
|
||||
++it;
|
||||
if(it == activePlayerList->end()) it = activePlayerList->begin();
|
||||
++activePlayerIt;
|
||||
if(activePlayerIt == activePlayerList->end()) activePlayerIt = activePlayerList->begin();
|
||||
|
||||
if(activePlayerList->size() > 2) {
|
||||
//big blind normal
|
||||
(*it)->setMyButton(3);
|
||||
bigBlindPosition = (*it)->getMyUniqueID();
|
||||
(*activePlayerIt)->setMyButton(3);
|
||||
bigBlindPosition = (*activePlayerIt)->getMyUniqueID();
|
||||
} else {
|
||||
//small blind in heads up
|
||||
(*it)->setMyButton(2);
|
||||
smallBlindPosition = (*it)->getMyUniqueID();
|
||||
(*activePlayerIt)->setMyButton(2);
|
||||
smallBlindPosition = (*activePlayerIt)->getMyUniqueID();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -395,11 +395,11 @@ void LocalHand::switchRounds()
|
||||
|
||||
//log board cards for allin
|
||||
if(currentRound >= GAME_STATE_FLOP) {
|
||||
int tempBoardCardsArray[5];
|
||||
int boardCards[5];
|
||||
|
||||
myBoard->getMyCards(tempBoardCardsArray);
|
||||
myGui->logDealBoardCardsMsg(currentRound, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]);
|
||||
if(myLog) myLog->logBoardCards(tempBoardCardsArray);
|
||||
myBoard->getMyCards(boardCards);
|
||||
myGui->logDealBoardCardsMsg(currentRound, boardCards[0], boardCards[1], boardCards[2], boardCards[3], boardCards[4]);
|
||||
if(myLog) myLog->logBoardCards(boardCards);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -282,10 +282,10 @@ public:
|
||||
void turnEngine();
|
||||
void riverEngine();
|
||||
|
||||
void preflopEngine3();
|
||||
void flopEngine3();
|
||||
void turnEngine3();
|
||||
void riverEngine3();
|
||||
// void preflopEngine3();
|
||||
// void flopEngine3();
|
||||
// void turnEngine3();
|
||||
// void riverEngine3();
|
||||
|
||||
int flopCardsValue(int*);
|
||||
int turnCardsValue(int*);
|
||||
|
||||
@@ -82,14 +82,3 @@ void Tools::GetRand(int minValue, int maxValue, unsigned count, int *out)
|
||||
*startPtr++ = gen();
|
||||
}
|
||||
}
|
||||
|
||||
int Tools::bitcount(int in)
|
||||
{
|
||||
int count=0 ;
|
||||
while (in) {
|
||||
count++ ;
|
||||
in &= (in - 1) ;
|
||||
}
|
||||
return count ;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ public:
|
||||
|
||||
static void ShuffleArrayNonDeterministic(int *inout, unsigned count);
|
||||
static void GetRand(int minValue, int maxValue, unsigned count, int *out);
|
||||
static int bitcount(int in);
|
||||
|
||||
};
|
||||
|
||||
|
||||
+4
-4
@@ -755,22 +755,22 @@ Log::debugMode_getStartDealerPosition(unsigned* dealerPosition)
|
||||
}
|
||||
|
||||
void
|
||||
Log::debugMode_getBoardCards(int *tempBoardArray, int handID)
|
||||
Log::debugMode_getBoardCards(int *boardCards, int handID)
|
||||
{
|
||||
if(debug_mode) {
|
||||
if((unsigned)handID <= sizeof(debug_mode_boardCards)/sizeof(unsigned)/5) {
|
||||
for(int i=0; i<5; i++) tempBoardArray[i] = debug_mode_boardCards[handID-1][i];
|
||||
for(int i=0; i<5; i++) boardCards[i] = debug_mode_boardCards[handID-1][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Log::debugMode_getPlayerCards(int *tempPlayerArray, int handID, int seatID)
|
||||
Log::debugMode_getPlayerCards(int *playerCards, int handID, int seatID)
|
||||
{
|
||||
if(debug_mode) {
|
||||
if((unsigned)handID <= sizeof(debug_mode_playerCards)/sizeof(int)/MAX_NUMBER_OF_PLAYERS/2) {
|
||||
for(int i=0; i<2; i++) {
|
||||
if(debug_mode_playerCards[handID-1][seatID][i]>=0) tempPlayerArray[i] = debug_mode_playerCards[handID-1][seatID][i];
|
||||
if(debug_mode_playerCards[handID-1][seatID][i]>=0) playerCards[i] = debug_mode_playerCards[handID-1][seatID][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -792,20 +792,20 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog)
|
||||
//refresh board cards if game is running
|
||||
if(myStartWindow->getSession()->getCurrentGame()) {
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
int boardCards[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||
GameState currentState = myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->getMyBeRoID();
|
||||
if(currentState >= GAME_STATE_FLOP && currentState <= GAME_STATE_POST_RIVER)
|
||||
for(int i=0; i<3; i++) {
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[i], 10)+".png"));
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[i], 10)+".png"));
|
||||
boardCardsArray[i]->setPixmap(card, false);
|
||||
}
|
||||
if(currentState >= GAME_STATE_TURN && currentState <= GAME_STATE_POST_RIVER) {
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[3], 10)+".png"));
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[3], 10)+".png"));
|
||||
boardCardsArray[3]->setPixmap(card, false);
|
||||
}
|
||||
if(currentState == GAME_STATE_RIVER || currentState == GAME_STATE_POST_RIVER) {
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[4], 10)+".png"));
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[4], 10)+".png"));
|
||||
boardCardsArray[4]->setPixmap(card, false);
|
||||
}
|
||||
}
|
||||
@@ -1532,10 +1532,10 @@ void gameTableImpl::dealFlopCards3()
|
||||
void gameTableImpl::dealFlopCards4()
|
||||
{
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
int boardCards[5];
|
||||
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[0], 10)+".png"));
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[0], 10)+".png"));
|
||||
|
||||
//Config? mit oder ohne Eye-Candy?
|
||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||
@@ -1552,9 +1552,9 @@ void gameTableImpl::dealFlopCards4()
|
||||
void gameTableImpl::dealFlopCards5()
|
||||
{
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[1], 10)+".png"));
|
||||
int boardCards[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[1], 10)+".png"));
|
||||
|
||||
//Config? mit oder ohne Eye-Candy?
|
||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||
@@ -1571,9 +1571,9 @@ void gameTableImpl::dealFlopCards5()
|
||||
void gameTableImpl::dealFlopCards6()
|
||||
{
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[2], 10)+".png"));
|
||||
int boardCards[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[2], 10)+".png"));
|
||||
|
||||
//Config? mit oder ohne Eye-Candy?
|
||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||
@@ -1615,9 +1615,9 @@ void gameTableImpl::dealTurnCards1()
|
||||
void gameTableImpl::dealTurnCards2()
|
||||
{
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[3], 10)+".png"));
|
||||
int boardCards[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[3], 10)+".png"));
|
||||
|
||||
//Config? mit oder ohne Eye-Candy?
|
||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||
@@ -1660,9 +1660,9 @@ void gameTableImpl::dealRiverCards1()
|
||||
void gameTableImpl::dealRiverCards2()
|
||||
{
|
||||
|
||||
int tempBoardCardsArray[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(tempBoardCardsArray[4], 10)+".png"));
|
||||
int boardCards[5];
|
||||
myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards);
|
||||
QPixmap card = QPixmap::fromImage(QImage(myCardDeckStyle->getCurrentDir()+QString::number(boardCards[4], 10)+".png"));
|
||||
|
||||
//Config? mit oder ohne Eye-Candy?
|
||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||
@@ -4310,8 +4310,7 @@ void gameTableImpl::restoreGameTableGeometry()
|
||||
int availableHeight = dw.screenGeometry().height();
|
||||
this->showNormal();
|
||||
this->setGeometry(0,0,availableWidth, availableHeight);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this->showFullScreen();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -42,6 +42,7 @@ using namespace std;
|
||||
|
||||
guiLog::guiLog(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), myHtmlLogFile(0), myHtmlLogFile_old(0), myTxtLogFile(0), tb(0)
|
||||
{
|
||||
newVersion = true;
|
||||
|
||||
myW->setGuiLog(this);
|
||||
myStyle = myW->getMyGameTableStyle();
|
||||
@@ -470,8 +471,6 @@ void guiLog::showLog(QString fileStringPdb, QTextBrowser *tb_tmp, int uniqueGame
|
||||
|
||||
int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
{
|
||||
bool neu = true;
|
||||
|
||||
result_struct results;
|
||||
results.result_Session = 0;
|
||||
results.result_Game = 0;
|
||||
@@ -567,7 +566,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
switch(modus) {
|
||||
case 1:
|
||||
log_string = "<h3><b>" + log_string + "</b></h3>\n";
|
||||
// if(!neu) log_string = "<img src='logo.png'>\n" + log_string;
|
||||
// if(!newVersion) log_string = "<img src='logo.png'>\n" + log_string;
|
||||
break;
|
||||
case 2:
|
||||
log_string += "";
|
||||
@@ -658,7 +657,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
switch(modus) {
|
||||
case 1:
|
||||
log_string = "<table><tr><td width=\"600\" align=\"center\"><hr noshade size=\"3\"><b>" + log_string;
|
||||
if(!neu) log_string += "</b></td><td></td></tr></table>";
|
||||
if(!newVersion) log_string += "</b></td><td></td></tr></table>";
|
||||
else log_string += "</b></td></tr></table>";
|
||||
break;
|
||||
case 2:
|
||||
@@ -720,7 +719,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
|
||||
switch(modus) {
|
||||
case 1:
|
||||
if(!neu) log_string += "</br>";
|
||||
if(!newVersion) log_string += "</br>";
|
||||
else log_string += "<br />";
|
||||
break;
|
||||
case 2:
|
||||
@@ -758,7 +757,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
log_string += ")";
|
||||
switch(modus) {
|
||||
case 1:
|
||||
if(!neu) log_string += "</br>";
|
||||
if(!newVersion) log_string += "</br>";
|
||||
else log_string += "<br />";
|
||||
break;
|
||||
case 2:
|
||||
@@ -781,7 +780,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
}
|
||||
}
|
||||
|
||||
if(neu) {
|
||||
if(newVersion) {
|
||||
|
||||
if(modus == 1) log_string += "<br />";
|
||||
|
||||
@@ -903,7 +902,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
if(nRow_Action == 1) {
|
||||
switch(modus) {
|
||||
case 1:
|
||||
if(!neu) log_string += "</br>";
|
||||
if(!newVersion) log_string += "</br>";
|
||||
else log_string += "<br />";
|
||||
break;
|
||||
case 2:
|
||||
@@ -921,7 +920,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
|
||||
}
|
||||
|
||||
if(!neu && modus==1) log_string += "</br>";
|
||||
if(!newVersion && modus==1) log_string += "</br>";
|
||||
|
||||
writeLog(log_string,modus);
|
||||
log_string = "";
|
||||
@@ -949,10 +948,10 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
}
|
||||
switch(modus) {
|
||||
case 1:
|
||||
if(!neu) round_string = "</br><b>" + round_string + "</b>";
|
||||
if(!newVersion) round_string = "</br><b>" + round_string + "</b>";
|
||||
else round_string = "<br /><b>" + round_string + "</b>";
|
||||
if(round_ctr >= GAME_STATE_FLOP) {
|
||||
if(!neu) round_string = "</br>\n" + round_string;
|
||||
if(!newVersion) round_string = "</br>\n" + round_string;
|
||||
else round_string = "<br />\n" + round_string;
|
||||
}
|
||||
break;
|
||||
@@ -1019,7 +1018,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
for(action_ctr=1; action_ctr<=nRow_Action; action_ctr++) {
|
||||
switch(modus) {
|
||||
case 1:
|
||||
if(!neu) {
|
||||
if(!newVersion) {
|
||||
if(action_ctr>1 && (boost::lexical_cast<std::string>(results.result_Action[3*(action_ctr-1)+1]) == "wins" || boost::lexical_cast<std::string>(results.result_Action[3*(action_ctr-1)+1]) == "sits out" || boost::lexical_cast<std::string>(results.result_Action[3*(action_ctr-1)+1]) == "wins (side pot)"))
|
||||
log_string += "\n";
|
||||
else
|
||||
@@ -1037,7 +1036,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
default:
|
||||
;
|
||||
}
|
||||
if(!neu && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins (side pot)") {
|
||||
if(!newVersion && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins (side pot)") {
|
||||
action_string += player[boost::lexical_cast<int>(results.result_Action[3*action_ctr])-1];
|
||||
action_string += " wins $";
|
||||
action_string += boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+2]);
|
||||
@@ -1057,7 +1056,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins game") {
|
||||
switch(modus) {
|
||||
case 1:
|
||||
if(!neu) action_string = "</br></br><i><b>" + action_string + " " + boost::lexical_cast<std::string>(gameID) + "!</i></b></br>";
|
||||
if(!newVersion) action_string = "</br></br><i><b>" + action_string + " " + boost::lexical_cast<std::string>(gameID) + "!</i></b></br>";
|
||||
else action_string = "</br><i><b>" + action_string + " " + boost::lexical_cast<std::string>(gameID) + "!</b></i>";
|
||||
break;
|
||||
case 2:
|
||||
@@ -1075,7 +1074,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "wins (side pot)") {
|
||||
switch(modus) {
|
||||
case 1:
|
||||
if(!neu) action_string = "</br><i>" + action_string + "</i>";
|
||||
if(!newVersion) action_string = "</br><i>" + action_string + "</i>";
|
||||
else action_string = "<i>" + action_string + "</i>";
|
||||
break;
|
||||
case 3:
|
||||
@@ -1090,7 +1089,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has left the game" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "was kicked from the game" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "is game admin now" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has joined the game") {
|
||||
switch(modus) {
|
||||
case 1:
|
||||
if(!neu) action_string = "<i>" + action_string + "!</i>";
|
||||
if(!newVersion) action_string = "<i>" + action_string + "!</i>";
|
||||
else action_string = "<i>" + action_string + "</i>";
|
||||
break;
|
||||
case 3:
|
||||
@@ -1105,7 +1104,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "sits out") {
|
||||
switch(modus) {
|
||||
case 1:
|
||||
if(!neu) action_string = "</br><i><span style=\"font-size:smaller;\">" + action_string + "</span></i>";
|
||||
if(!newVersion) action_string = "</br><i><span style=\"font-size:smaller;\">" + action_string + "</span></i>";
|
||||
else action_string = "<i><span style=\"font-size:smaller;\">" + action_string + "</span></i>";
|
||||
break;
|
||||
case 3:
|
||||
@@ -1122,7 +1121,7 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
// show cards
|
||||
if(boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "shows" || boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) == "has") {
|
||||
// log cards
|
||||
if(!neu && round_ctr == GAME_STATE_POST_RIVER) log_string += " [ ";
|
||||
if(!newVersion && round_ctr == GAME_STATE_POST_RIVER) log_string += " [ ";
|
||||
else log_string += " [";
|
||||
if(modus == 1 || modus == 3) log_string += "<b>";
|
||||
|
||||
@@ -1193,10 +1192,10 @@ int guiLog::exportLog(QString fileStringPdb,int modus,int uniqueGameID_req)
|
||||
|
||||
}
|
||||
|
||||
if(!neu && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "shows" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "sits out" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins (side pot)" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has joined the game") {
|
||||
if(!newVersion && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "shows" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "sits out" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins (side pot)" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has joined the game") {
|
||||
log_string += ".";
|
||||
}
|
||||
if(neu && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has joined the game")
|
||||
if(newVersion && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "wins game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has left the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "was kicked from the game" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "is game admin now" && boost::lexical_cast<std::string>(results.result_Action[3*action_ctr+1]) != "has joined the game")
|
||||
log_string += ".";
|
||||
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ private:
|
||||
QTextBrowser* tb;
|
||||
GameTableStyleReader *myStyle;
|
||||
std::string mySqliteLogFileName;
|
||||
bool newVersion;
|
||||
|
||||
friend class GuiWrapper;
|
||||
|
||||
|
||||
@@ -180,8 +180,8 @@ void LogFileDialog::exportLogToTxt()
|
||||
if(selectedItem) {
|
||||
QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString());
|
||||
QFileDialog dlg(this, tr("Export PokerTH log file to plain text"),
|
||||
QDir::homePath()+"/"+fi.baseName()+".txt",
|
||||
tr("PokerTH plain text log (*.txt)"));
|
||||
QDir::homePath()+"/"+fi.baseName()+".txt",
|
||||
tr("PokerTH plain text log (*.txt)"));
|
||||
dlg.setFileMode(QFileDialog::AnyFile);
|
||||
dlg.setAcceptMode(QFileDialog::AcceptSave);
|
||||
#ifdef ANDROID
|
||||
@@ -251,8 +251,7 @@ void LogFileDialog::keyPressEvent ( QKeyEvent * event )
|
||||
if(ui->treeWidget_logFiles->hasFocus()) {
|
||||
ui->pushButton_deleteLog->click();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
QDialog::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user