Beispiel #1
0
        private List <int[]> GetKingMoves(List <int> indexes, Game.PieceColor color)
        {
            List <int[]> moves = new List <int[]>();

            foreach (int ind in indexes)
            {
                int rank = ind / 8;
                int file = ind % 8;

                if (color == Game.PieceColor.White)
                {
                    ulong        wkmoves    = Moves.GetKingMoves(rank, file, chessboard.AllWhite) | Moves.GetWhiteCastleMoves(rank, file, chessboard.AllWhite, board, chessboard);
                    List <int[]> thesemoves = ConvertMove(board.ClipCheck(wkmoves, ind), ind);
                    moves.AddRange(thesemoves);
                }
                else
                {
                    ulong        bkmoves    = Moves.GetKingMoves(rank, file, chessboard.AllBlack) | Moves.GetBlackCastleMoves(rank, file, chessboard.AllBlack, board, chessboard);
                    List <int[]> thesemoves = ConvertMove(board.ClipCheck(bkmoves, ind), ind);
                    moves.AddRange(thesemoves);
                }
            }
            return(moves);
        }