コード例 #1
0
        public Tournament(MapCatalog mCatalog, List <string> maps, List <string> bots)
        {
            var errorSb = new StringBuilder();

            PopulateBotConstructors();
            CheckBots(bots, errorSb);
            CheckMaps(maps, mCatalog, errorSb);
            if (errorSb.Length > 0)
            {
                throw  new Exception(errorSb.ToString());
            }

            m_mapNames = maps;
            m_botNames = bots;
            m_mCatalog = mCatalog;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: marc2982/cell
        static void Main(string[] args)
        {
            var options = new Options();

            CommandLine.Parser.Default.ParseArguments(args, options);
            options.CheckValues();

            var mapCat = MapCatalog.Load(options.MapCatalogFilePath);
            var tc     = TournamentConfig.Load(options.TournamentConfigFilePath);

            var tournament = new Tournament(mapCat, tc.Maps, tc.Bots);
            var results    = tournament.Run();

            Console.WriteLine(results);

            Console.ReadLine();
        }
コード例 #3
0
 //Check that the maps we want to use are in the map catalog
 //A map will be in the catalog if it was deserialized from the file passed in as a command line argument
 public void CheckMaps(List <string> maps, MapCatalog mCatalog, StringBuilder errorSb)
 {
     if (maps == null || maps.Count < 1)
     {
         errorSb.AppendLine("ERROR: A tournament needs at least one map.");
     }
     else
     {
         foreach (var map in maps)
         {
             if (!mCatalog.MapExists(map))
             {
                 errorSb.AppendLine($"ERROR: Can't find map '{map}' in map catalog.");
             }
         }
     }
 }