public List <GameSimulationResult> SimulateGame(List <IAi> gamers, Map map, Settings settings) { var gameSimulator = new GameSimulator(map, settings, eatExceptions); gameSimulator.StartGame(gamers); var state = gameSimulator.NextMove(); var turnTime = new StatValue(); while (!state.IsGameOver) { var lastMove = state.PreviousMoves.Last(); if (!silent) { Console.WriteLine($"{lastMove}"); } var time = Stopwatch.StartNew(); state = gameSimulator.NextMove(); turnTime.Add(time.ElapsedMilliseconds); } map = state.CurrentMap; return(gamers .Zip(gameSimulator.Futures, (ai, futures) => new { Gamer = ai, Futures = futures }) .Select((e, i) => new GameSimulationResult( e.Gamer, scoreCalculator.GetScoreData(i, state.CurrentMap, e.Futures), gameSimulator.GetLastException(e.Gamer), (double)map.OptionsUsed.GetOrDefaultNoSideEffects(i, 0) / map.Mines.Length, turnTime)) .ToList()); }
public void SetUp() { map = MapLoader.LoadMapByName("sample.json"); simulator = new GameSimulator(map.Map, new Settings()); }