Beispiel #1
0
        static void Main(string[] args)
        {
            var chess = new Chess("rnbqkbnr/p2pp1pp/8/1pp2p2/3P1P2/3B4/PP1P1PPP/RNBQK1NR w KQkq - 0 1");
            var nums  = Extentions.ValidMoves(3, chess);

            Console.WriteLine(nums);
            // return;

            while (true)
            {
                //Console.WriteLine(chess.fen);
                Extentions.Print(Extentions.ChessToAscii(chess));
                var move = Console.ReadLine();
                if (move == string.Empty)
                {
                    break;
                }

                chess = chess.Move(move);
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            //"r2qkb1r/pb1nppp1/2p4p/1p1nP1B1/2pPN3/5N2/PP2BPPP/R2QK2R w - - 0 1"
            var chess  = new Chess("rnb1kbnr/ppppqppp/8/8/8/8/PPPP1PPP/RNBQKBNR b - - 0 1");
            var solver = new ChessSolver(2);

            while (true)
            {
                Extentions.Print(Extentions.ChessToAscii(chess));
                Console.WriteLine(solver.EvaluatePosition(chess));

                if (HasMateOrStaleMate(chess))
                {
                    break;
                }

                string bestMove;
                if (chess.MoveColor == Color.white)
                {
                    do
                    {
                        bestMove = Console.ReadLine();
                    } while (bestMove.Trim() == string.Empty);
                }
                else
                {
                    bestMove = solver.FindBestMove(chess, 3);
                }

                Console.WriteLine("BestMove = " + bestMove);

                chess = chess.Move(bestMove);
                Console.WriteLine(chess.fen);
            }

            Console.ReadKey();
        }