コード例 #1
0
        public Worker(WorkerOptions opts)
        {
            this._opts = opts;

            this._rng         = opts.Seed.HasValue ? new Random(opts.Seed.Value) : Constants.GlobalRng;
            this._botCommands = EnsureFourBotCommands(opts.Commands);
            this._simulator   = new Simulator(opts.Configuration);
            this._processes   = new Dictionary <string, BotProcess>(4);
            this._playerIds   = new List <string>();
            this._watch       = new Stopwatch();
            this._playerInitialisationDuration = this._opts.NoTimeout ? TimeSpan.MaxValue : TimeSpan.FromSeconds(10);
            this._tickDuration = this._opts.NoTimeout ? TimeSpan.MaxValue : TimeSpan.FromSeconds(1.1);
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            var parsedArgs = ProgramArguments.Parse(args);

            if (parsedArgs.ShowHelp)
            {
                parsedArgs.WriteHelp(Console.Out);
                return;
            }

            var configuration = GetRequestedConfiguration(parsedArgs.ConfigurationPath);

            configuration.Seed = parsedArgs.Seed ?? Math.Abs(Guid.NewGuid().GetHashCode());

            for (var iter = 1; iter <= parsedArgs.RepeatCount; iter++)
            {
                var outputFile = GetOutputFile(parsedArgs.OutputPath, iter);
                var opts       = new WorkerOptions(parsedArgs, iter, outputFile, configuration);

                using var worker = new Worker(opts);
                worker.Work();
            }
        }