Esempio n. 1
0
        public void Fight(IEngine engineA, IEngine engineB, BitBoard board, int index = 0)
        {
            var indexText  = index.ToString().PadLeft(6, '0');
            var targetFile = Path.Combine(fightPath,
                                          $"{indexText} {DateTime.Now:yyyy-MM-dd HH-mm} {engineA.Name}-{engineB.Name}.tmp");

            FightResult fightResult;

            using (var cc = ConsoleCopy.Create(targetFile))
            {
                Console.WriteLine("################### Begin #######################");
                Console.WriteLine("{0} ({2}) vs {1} ({3})", engineA.Name, engineB.Name, "Black", "White");

                fightResult = DoFight(engineA, engineB, board);

                Console.WriteLine("################### Result #######################");
                Console.WriteLine("{0}", fightResult);
                Console.WriteLine("#################### End #######################");
            }

            var score         = fightResult.WinnerName == engineA.Name ? fightResult.Score : -fightResult.Score;
            var newTargetFile = Path.Combine(fightPath,
                                             $"{indexText} {engineA.Name}-{engineB.Name} ({score}) {DateTime.Now:yyyy-MM-dd HH-mm}.txt");

            File.Move(targetFile, newTargetFile);
        }
Esempio n. 2
0
 static void Main(string[] args)
 {
     try
     {
         ConsoleCopy.Create();
         var sw = Stopwatch.StartNew();
         DeepLearning.Test();
         sw.Stop();
         Console.WriteLine($"done! {sw.Elapsed}");
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
     Console.Read();
 }
Esempio n. 3
0
        public void Fight(IEngine engineA, IEngine engineB, string targetPath, BitBoard board)
        {
            var targetFile = Path.Combine(targetPath,
                                          string.Format("{0:yyyy-MM-dd HH-mm} {1}-{2}.txt", DateTime.Now, engineA.Name, engineB.Name));

            using (var cc = ConsoleCopy.Create(targetFile))
            {
                Console.WriteLine("################### Begin #######################");
                Console.WriteLine("{0} ({2}) vs {1} ({3})", engineA.Name, engineB.Name, "Black", "White");

                var fightResult = Fight(engineA, engineB, board);

                Console.WriteLine("################### Result #######################");
                Console.WriteLine("{0}", fightResult);
                Console.WriteLine("#################### End #######################");
            }
        }