public Engine GetEngine(IEnumerable <IFighterStats> fighters, MatchOptionsDto optionsDto)
        {
            var qualified = fighters;

            if (optionsDto.MaxPowerlevel != null)
            {
                qualified = qualified.Where(o => o.Stats.PowerLevel() <= optionsDto.MaxPowerlevel);
            }

            if ((optionsDto.BotCount > 0 && optionsDto.BotCount < 1000) && optionsDto.BotPowerlevel > 10)
            {
                qualified = qualified
                            .Union(FighterFactory.GetFighters(optionsDto.BotCount.Value, optionsDto.BotPowerlevel.Value));
            }

            return(new Engine(
                       cfg =>
            {
                cfg.ActionsPerRound = optionsDto.ActionsPerRound;
                cfg.Battlefield = battlefields.FirstOrDefault(o => o.Id == optionsDto.Battlefield);
                cfg.Bounds = bounds.FirstOrDefault(o => o.Id == optionsDto.Bounds);
                cfg.Features = engineFeatures.Where(o => optionsDto.Features.Contains(o.Id)).ToList();
                cfg.MoveOrder = moveOrders.FirstOrDefault(o => o.Id == optionsDto.MoveOrder);
                cfg.PositionGenerator = fighterPositionGenerators.FirstOrDefault(o => o.Id == optionsDto.PositionGenerator);
                cfg.StaleCondition = staleConditions.FirstOrDefault(o => o.Id == optionsDto.StaleCondition);
                cfg.WinCondition = winConditions.FirstOrDefault(o => o.Id == optionsDto.WinCondition);

                cfg.CalculationValues.VisionFactor = 10;

                return cfg;
            }, qualified.ToList()));
        }
 public static Engine GetDefaultEngine(int fighterCount, int powerlevel)
 {
     return(GetDefaultEngine(FighterFactory.GetFighters(fighterCount, powerlevel)));
 }
 public static Engine GetDefaultDeathmatchEngine(int fighterCount, Action <IStats> customStats)
 {
     return(GetDefaultDeathmatchEngine(FighterFactory.GetFighters(fighterCount, customStats)));
 }