protected override async Task <bool> RunSimulationAsync(byte[] settingsBuf, bool withPolicy = false) { var settings = Serializer.Deserialize <Settings>(settingsBuf.AsSpan()); if (withPolicy) { sim = new HotstorageSimulation(settings, new RuleBasedCranePolicy()); } else { sim = new HotstorageSimulation(settings); } sim.SetLogger(Logger); sim.WorldChanged += OnWorldChanged; await sim.RunAsync(); Logger.WriteLine("Run completed"); return(!aborted); }
protected override bool RunSimulation(byte[] settingsBuf, string url, string id, bool simulateAsync = true, bool useIntegratedPolicy = false) { var settings = Serializer.Deserialize <Settings>(settingsBuf.AsSpan()); if (useIntegratedPolicy) { sim = new HotstorageSimulation(settings, new RuleBasedCranePolicy()); } else { sim = new HotstorageSimulation(settings, new SynchronousSimRunnerPolicy(url, id)); } sim.SetLogger(Logger); sim.SimulateAsync = simulateAsync; sim.WorldChanged += OnWorldChanged; Logger.WriteLine("Starting sim"); sim.Run(); return(!aborted); }