public static double MonteCarlo(AttackPattern toSimulate, StatsGroup stats, double duration, int count) { double total = 0; double[] results = new double[count]; Parallel.For(0, count, i => { SimpleSimulator sim = new SimpleSimulator(); results[i] = sim.Simulate(toSimulate, stats, duration); }); for (int i = 0; i < count; ++i) { //results[i] = Simulate(toSimulate, stats, duration); total += results[i]; } return(total / count); }
public SimulatedAttackPattern(AttackPattern toSimulate, StatsGroup stats, SimpleSimulator sim) { this.ToSimulate = toSimulate; this.Stats = stats; this.Sim = sim; }