Exemplo n.º 1
0
        static void Main(string[] args)
        {
            EGTB.Init(AppDomain.CurrentDomain.BaseDirectory, new WindowsStreamCreator());

            Console.WriteLine("Gaviota EGTB .NET prober, enter FEN string to probe and hit enter\n");

            while (running)
            {
                ProcessInput(Console.ReadLine());
            }
        }
Exemplo n.º 2
0
        static void ProcessInput(string s)
        {
            if ((s == "quit") || (s == "exit"))
            {
                running = false;
                return;
            }

            if (DidSetupSquaresFromFen(s))
            {
                ProbeResultType pr = EGTB.Probe(whitePieceSquares, blackPieceSquares, whiteTypesSquares, blackTypesSquares, whosTurn, enPassantSquare);
                if (pr.found)
                {
                    if (pr.stm == MateResult.BlackToMate)
                    {
                        Console.WriteLine("Black to mate in {0} plies", pr.ply);
                    }
                    else if (pr.stm == MateResult.WhiteToMate)
                    {
                        Console.WriteLine("White to mate in {0} plies", pr.ply);
                    }
                    else if (pr.stm == MateResult.Draw)
                    {
                        Console.WriteLine("Draw", pr.ply);
                    }
                    else
                    {
                        Console.WriteLine("No match in EGTB", pr.ply);
                    }
                }
                else
                {
                    Console.WriteLine("Could not find it: " + pr.error);
                }
            }
            else
            {
                Console.WriteLine("FEN string not accepted, max 5 man tables allowed for probe");
            }
        }