Exemple #1
0
        private static void Main(string[] args)
        {
            CommandLineParser parser = new CommandLineParser(args);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.Automatic);
            Application.ThreadException += Application_ThreadException;

            int seed = (int) DateTime.Now.Ticks;

            if (parser["seed"] != null) seed = Convert.ToInt32(parser["seed"]);

            switch (parser["mode"])
            {
                case "profile":
                {
                    PopulationSingleRun populationSingleRun = new PopulationSingleRun(Board.FromIBoardSource(new BoardSourceStatistical(10, 10, seed)));
                    populationSingleRun.GetBestGenome();

                    return;
                }
                case "stats":
                {
                    Application.Run(new StatBootstrapForm());

                    return;
                }
            }

            Application.Run(new GamePlayerForm());
        }
        public void RunAnalysis()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();
            for (int i = 0; i < runCount; i++)
            {
                populationSingleRun = new PopulationSingleRun(populationSettings, Board.FromIBoardSource(boardSource)) {IsReseedRequired = true};
                Genome genome = populationSingleRun.GetBestGenome();

                results.Add(genome);
                InvokeRunFinished(new RunEventArgs(i + 1));
            }
            stopwatch.Stop();
            RunTimeElapsed = stopwatch.ElapsedMilliseconds;
            InvokeAnalysisFinished(EventArgs.Empty);
        }