/// <summary> /// Given S and B = B(S), verify that B is the best strategy against S. /// Procedure: Verify EV(B', S) is less than EV(B, S) for all other strategies B'. /// </summary> public static void B_Test(PocketRoot root) { number EV; // Calculate Strategy B = B(S) EV = root.BestAgainstS(); // Calculate EV(B', S) for many B' double Min = double.MaxValue; for (int k = 0; k < 10000; k++) { // Pure passive //root.Process(Node.VarB, (n, i) => (number)0); // Pure aggressive //root.Process(Node.VarB, (n, i) => (number)1); // Totally randomize //root.Process(Node.VarB, (n, i) => (number)(Tools.Rnd.NextDouble())); // Random perturbation //root.Process(Node.VarB, (n, i) => n.B[i] + (number)((Tools.Rnd.NextDouble() - .5f) * .1f)); // Random raise root.Process(Node.VarB, (n, i) => n.B[i] + (number)(Tools.Rnd.NextDouble() > .85 ? 1 : 0)); // Random fold //root.Process(Node.VarB, (n, i) => n.B[i] + (number)(Tools.Rnd.NextDouble() > .99 ? -1 : 0)); // Full simulation //number ModdedEV = Simulation(Node.VarB, Node.VarS, root); // Monte Carlo simulation var game = new Game(new StrategyPlayer(Node.VarB), new StrategyPlayer(Node.VarS), Seed: 0); float ModdedEV = (float)game.Round(4999999); Tools.LogPrint("Monte Carlo Simulation EV = {0}", ModdedEV); Min = Math.Min((double)Min, (double)EV - (double)ModdedEV); Tools.LogPrint("Difference = {0}, min = {1}", (double)EV - (double)ModdedEV, Min); } }
private static void Iteration_Test(int i, number EV_FromBest) { if (i % Setup.Test_Period == 0 && i != StartIteration) { // Monte Carlo Simulation var game = new Game(new StrategyPlayer(Node.VarB), new StrategyPlayer(Node.VarS), Seed: 0); float EV_FromMonteCarlo = (float)game.Round(2999999); Tools.LogPrint("Monte Carlo Simulation EV = {0}", EV_FromMonteCarlo); //// Full Simulation //number EV_FromSim = Tests.Simulation(Node.VarB, Node.VarS, GameRoot); //Tools.LogPrint("Simulated EV = {0}", EV_FromSim); } }