示例#1
0
        public static void Main()
        {
            var cb = ChessBoardInstances.Get(0);

            MainEngine.MaxDepth             = MaxPly;
            UciOut.NoOutput                 = true;
            EngineConstants.Power2TtEntries = 2;
            TtUtil.Init(false);
            long totalNodesSearched = 0;

            var epdStrings = BestMoveTest.GetEpdStrings("Resources/WAC-201.epd");

            for (var index = 0; index < NumberOfPositions; index++)
            {
                Console.WriteLine(index);
                var epdString = epdStrings[index + 20];
                Statistics.Reset();
                var epd = new Epd(epdString);
                ChessBoardUtil.SetFen(epd.GetFen(), cb);
                SearchUtil.Start(cb);
                totalNodesSearched += ChessBoardUtil.CalculateTotalMoveCount();
            }

            Console.WriteLine("Total   " + totalNodesSearched);
            Console.WriteLine("Average " + totalNodesSearched / NumberOfPositions);
        }
示例#2
0
        private static void DoTest(IReadOnlyCollection <string> epdStrings)
        {
            var correctCounter = 0;

            foreach (var epdString in epdStrings)
            {
                var epd = new Epd(epdString);
                var cb  = ChessBoardInstances.Get(0);
                ChessBoardUtil.SetFen(epd.GetFen(), cb);

                TimeUtil.Reset();
                TimeUtil.SetSimpleTimeWindow(5000);
                SearchUtil.Start(cb);

                var bestMove = new MoveWrapper(ThreadData.GetBestMove());
                if (epd.IsBestMove)
                {
                    if (epd.MoveEquals(bestMove))
                    {
                        Console.WriteLine(epd.GetId() + " BM OK");
                        correctCounter++;
                        _positionTestOk++;
                    }
                    else
                    {
                        Console.WriteLine(epd.GetId() + " BM NOK " + bestMove + " - " + epd);
                        _positionTestNok++;
                    }
                }
                else
                {
                    if (epd.MoveEquals(bestMove))
                    {
                        Console.WriteLine(epd.GetId() + " AM NOK " + epd);
                        _positionTestNok++;
                    }
                    else
                    {
                        Console.WriteLine(epd.GetId() + " AM OK");
                        correctCounter++;
                        _positionTestOk++;
                    }
                }
            }

            Console.WriteLine(correctCounter + "/" + epdStrings.Count);
        }