private static void RunSimulationAndPrintResults(Game game) { const int numSamples = 100000; var rs = new RunningStat(); rs.Clear(); for (int i = 0; i < numSamples; ++i) { PairingSimulation.RandomizeResult(ref game); rs.Push(game.BlackResult); } PrintStatisticResults("normal", 32, 7 * 7, rs.Mean(), rs.Variance(), rs.resultlist.Min(), rs.resultlist.Max()); PrintGameResultStats(rs); }
public void TestStandardDeviationForGame() { const int numSamples = 100000; var rs = new RunningStat(); rs.Clear(); var mean = 32; var stdev = 7; for (int i = 0; i < numSamples; ++i) { rs.Push(SimpleRNG.GetNormal(mean, stdev)); } PrintStatisticResults("normal", mean, stdev * stdev, rs.Mean(), rs.Variance(), rs.resultlist.Min(), rs.resultlist.Max()); PrintGameResultStats(rs); }
private static void PrintGameResultStats(RunningStat rs) { Console.WriteLine( $"Black wins {CalcResult(rs, r => r > 32)}, Draws {CalcResult(rs, r => r == 32)}, White wins {CalcResult(rs, r => r < 32)}"); }