Ejemplo n.º 1
0
        internal static bool CheckForMate(ChessPieceColor whosTurn, ChessBoard chessBoard)
        {
            SearchMove.SearchForMate(whosTurn, chessBoard, ref chessBoard.blackInMate,
                                     ref chessBoard.whiteInMate, ref chessBoard.staleMate);

            if (chessBoard.blackInMate || chessBoard.whiteInMate || chessBoard.staleMate)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        public static void EngineMove(ChessBoard board)
        {
            if (CheckForMate(board.WhoseMove, board))
            {
                return;
            }

            System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
            watch.Start();

            //If there is no playbook move search for the best move
            MoveContent bestMove = SearchMove.AlphaBetaRoot(board, Constants.ply);

            ChessEngine.MoveContent(board, bestMove.MovingPiecePrimary.SrcPosition, bestMove.MovingPiecePrimary.DstPosition, ChessPieceType.Queen);

            PieceValidMoves.GenerateValidMoves(board);
            Evaluation.EvaluateBoardScore(board);

            System.Diagnostics.Debug.WriteLine("Engine Move Time: " + watch.ElapsedTicks);
        }