Example #1
0
 static void Main(string[] args)
 {
     using (IChessBoard board = new OX88Chessboard())
         using (var tt = new UnmanagedTranspositionTable())
         {
             WinBoardAdapter adapter = new WinBoardAdapter(board, new FullEngine(5, tt), tt);
             adapter.MessageToWinboard += new EventHandler <EngineToWinboardEventArgs>(adapter_MessageToWinboard);
             string line;
             while (null != (line = Console.ReadLine()))
             {
                 adapter.Consume(line);
             }
         }
 }
Example #2
0
        private void DoPerftTest(string line, ITranspositionTable tt)
        {
            string[] chunks = line.Split(';');
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Testing position:" + chunks[0]);
            Console.ForegroundColor = ConsoleColor.White;
            OX88Chessboard board = new OX88Chessboard(chunks[0]);

            for (int i = 1; i < chunks.Length; ++i)
            {
                int      level; ulong expected;
                string[] items = chunks[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                level    = int.Parse(items[0].Substring(1));
                expected = ulong.Parse(items[1]);
                Console.Write("Performing perft {0}. Expected:{1}\t", level, expected);
                PerfResults res = board.Perft(level, true, tt);
                Console.ForegroundColor = res.MovesCount == expected ? ConsoleColor.DarkGreen : ConsoleColor.Red;
                Console.WriteLine("Found:{0}\t\t\t{1}", res.MovesCount, res.MovesCount == expected ? "SUCCESS!" : "*ERROR*");
                Console.ForegroundColor = ConsoleColor.White;
            }
        }