Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Play Game?");
            if (Console.ReadLine().ToLower() == "y")
            {
                DNA smartAI = new DNA();
                smartAI.BuildPredefinedAI(1);
                smartAI.Wins        = 0;
                smartAI.Losses      = 0;
                smartAI.GamesPlayed = 0;
                DNA randomAI = new DNA();
                randomAI.BuildPredefinedAI(2);
                randomAI.Wins        = 0;
                randomAI.Losses      = 0;
                randomAI.GamesPlayed = 0;
                Player smartPlayer  = new Player("Medium Player", ref smartAI);
                Player randomPlayer = new Player("Hard Player", ref randomAI);
                Console.WriteLine("Game Count: ");
                int gamecount = Convert.ToInt32(Console.ReadLine());
                PlayLoop(gamecount, ref smartPlayer, ref randomPlayer, false);
                Console.Write("Games Played: ");
                Console.WriteLine(gamecount);
                Console.WriteLine(smartPlayer.name + " Won: " + smartPlayer.ai.Wins + " Games");
                Console.WriteLine(randomPlayer.name + " Won: " + randomPlayer.ai.Wins + " Games");
                Console.ReadLine();
                return;
            }
            Console.WriteLine("Use Default Evolution File?");
            if (Console.ReadLine().ToLower() == "n")
            {
                Console.WriteLine("Enter Path: ");
                EvolutionFilePath = Console.ReadLine();
            }
            Console.WriteLine("Use Default Progress File?");
            if (Console.ReadLine().ToLower() == "n")
            {
                Console.WriteLine("Enter Path: ");
                ProgressFilePath = Console.ReadLine();
            }

            Console.WriteLine("Load Evolution Progress?");
            if (Console.ReadLine().ToLower() == "y")
            {
                ReadEvolutionInfo();
            }
            else
            {
                Console.WriteLine("Population Size: ");
                PopulationSize = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Quick Play Iteration Count: ");
                QuickIterationCount = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Slow Play Iteration Count: ");
                SlowIterationCount = Convert.ToInt32(Console.ReadLine());
                CreateEvolutionFile();
            }
            Console.WriteLine("Load Iteration Progress?");
            if (Console.ReadLine().ToLower() == "y")
            {
                ReadProgressInfo();
            }
            else
            {
                //GeneratePopulation();
                NewGeneratePopulation();
            }
            NewMainLoop();
            Console.WriteLine("Finished");
            Console.ReadLine();
        }