private void calcCallRange() { int myIndex = 0; // BB int oppIndex = 1; // SB int range = 100; double EV = 0; // betit playersData[myIndex, 1] = BB; playersData[oppIndex, 1] = playersData[oppIndex, 0]; // ranget playersData[myIndex, 2] = 0; playersData[oppIndex, 2] = raiserRange; // etsitään ensimmäinen positiivinen call range for (range = 100; range > 0; range--) { //icm.handIndexToRandomHand(range, myHand); myHand = icm.handIndexToHand(range); EV = icm.calcCall(2, myHand, myIndex, oppIndex, playersData, ICMs, ICMc); if (EV > THRESHOLD) { break; } } //Console.WriteLine(playersData[0, 0] + " " + playersData[1, 0]); //Console.WriteLine("Ensimmainen positiivinen call range on " + range); //Console.WriteLine("Hand: " + icm.handToStr(myHand) + " EV: " + EV); callerRange = range; }
// We are in callerIndex and paying allin of raiserIndex private int calcCallRange(int callerIndex, int raiserIndex) { double[] EVs = { 0, 0, 0 }; int range = 0; // search for first call range which is below given level EVs[1] = icm.calcCall(players, icm.handIndexToHand(1), callerIndex, raiserIndex, playersData, payoutStructure, payoutStructure.Length); EVs[2] = icm.calcCall(players, icm.handIndexToHand(2), callerIndex, raiserIndex, playersData, payoutStructure, payoutStructure.Length); for (range = 3; range <= 100; range++) { EVs[0] = EVs[1]; EVs[1] = EVs[2]; EVs[2] = icm.calcCall(players, icm.handIndexToHand(range), callerIndex, raiserIndex, playersData, payoutStructure, payoutStructure.Length); //Debug.WriteLine("calcPushRange! Hand: " + icm.handToStr(myHand) + " EV: " + EV); if ((EVs[0] + EVs[1] + EVs[2]) / 3 < EVthreshold) { break; } } return(range - 1); }
// radioButtonPush.Checked, comboBoxPlayers.SelectedIndex + 2, comboBoxHand.SelectedIndex, ICMs, ICMc public double calcICM(bool mode) { results = new double[] { 0, 0 }; // push if (mode == true) { //System.Windows.Forms.MessageBox.Show("playersCount: " + Convert.ToString(playersCount) + " " + "handIndex: " + Convert.ToString(handIndex) + " " + "myIndex: " + Convert.ToString(myIndex())); icm.calcPush(playersCount, handIndex, myIndex(), playersData, results, ICMs, ICMs.Length); } // call if (mode == false) { icm.calcCall(playersCount, handIndex, myIndex(), allinIndex(), playersData, results, ICMs, ICMs.Length); } return(results[1] * 100 - results[0] * 100); }
private void calcOpponentsCallRanges() { // jos ollaan CALL -moodissa, niin muiden pelaajien call -rangeja ei tarvitse laskea if (pushOrCall == CALL) { return; } // lasketaan call % kaikille ennen omaa positiota oleville for (int i = position - 1; i >= 0; i--) { // alustetaan resetPlayersData, asetetaan stäkit ja maksetut blindit resetPlayersData(); for (int a = 0; a < numOfPlayers; a++) { playersData[a, 0] = stacks[a]; } playersData[0, 1] = BBsize; playersData[1, 1] = BBsize / 2; int[] hand = { 0, 0 }; // vastustajan indeksiksi oma paikka ja omaksi indeksiksi se jolle EV lasketaan int oppIndex = position; int myIndex = i; // "vastustaja" allissa playersData[oppIndex, 1] = playersData[oppIndex, 0]; playersData[oppIndex, 2] = raiserRange; // vaadittava EV satunnaisesti välille 0.2-0.5 double EVgoal = random.Next(20, 51) / 100.0; //double EVgoal = 0.2; // callaajat tyytyvät 0.2% EV etuun // etsitään karkea aloitusíndeksi käden vahvuudelle double EVresult = 0; int handIndex = 0; if (icm.calcCall(numOfPlayers, icm.handIndexToHand(5), myIndex, oppIndex, playersData, ICMs, ICMc) < EVgoal) { handIndex = 5; } else if (icm.calcCall(numOfPlayers, icm.handIndexToHand(10), myIndex, oppIndex, playersData, ICMs, ICMc) < EVgoal) { handIndex = 10; } else if (icm.calcCall(numOfPlayers, icm.handIndexToHand(20), myIndex, oppIndex, playersData, ICMs, ICMc) < EVgoal) { handIndex = 20; } else if (icm.calcCall(numOfPlayers, icm.handIndexToHand(50), myIndex, oppIndex, playersData, ICMs, ICMc) < EVgoal) { handIndex = 50; } else if (icm.calcCall(numOfPlayers, icm.handIndexToHand(75), myIndex, oppIndex, playersData, ICMs, ICMc) < EVgoal) { handIndex = 75; } else { handIndex = 100; } //Console.WriteLine("Alotusindeksi = {0}", handIndex); for (; handIndex > 1; handIndex--) { /* * if (i == 2) * { * Console.WriteLine("\n\n"); * Console.WriteLine("oppIndex: {0}", oppIndex); * Console.WriteLine("myIndex: {0}", myIndex); * for (int a = 0; a < 4; a++) * Console.WriteLine("{0}\t{1}\t{2}", playersData[a, 0], playersData[a, 1], playersData[a, 2]); * Console.WriteLine("hand: ({0}, {1}) index: {2}", icm.handIndexToHand(handIndex)[0], icm.handIndexToHand(handIndex)[1], handIndex); * Console.WriteLine("EV: {0}\n\n", icm.calcCall(numOfPlayers, icm.handIndexToHand(handIndex), myIndex, oppIndex, playersData, ICMs, ICMc)); * } */ EVresult = icm.calcCall(numOfPlayers, icm.handIndexToHand(handIndex), myIndex, oppIndex, playersData, ICMs, ICMc); if (EVresult > EVgoal) { //Console.WriteLine(" Kasi ({0}, {1}) EV: {2}", icm.handIndexToHand(handIndex)[0], icm.handIndexToHand(handIndex)[1], icm.calcCall(numOfPlayers, icm.handIndexToHand(handIndex), myIndex, oppIndex, playersData, ICMs, ICMc)); break; } } ranges[i] = handIndex; //Console.WriteLine("ranges[{0}] = {1}", i, handIndex); //Console.WriteLine("Lopetussindeksi = {0}", handIndex); } }