src/Engine/ChessEngine.cs
/// <summary>
/// Returns all possible squares a piece can move to, not considering
/// whether the move is legal (due to check) or whether the move results
/// in check, checkmate, or an ambiguous move.
/// </summary>
/// <param name="piece">The piece to move.</param>
/// <returns>A complete list of possible ending squares.</returns>
Returns all possible squares a piece can move to, not considering
whether the move is legal (due to check) or whether the move results
in check, checkmate, or an ambiguous move.
Returns all possible squares a piece can move to not considering whether the move is legal ( due to check ) or whether the move results in check checkmate or an ambiguous move .
public IEnumerable<Move> GetMoveOptions(ChessPiece piece) =>
            piece?.PieceType switch
            {
                ChessPieces.WhitePawn => GetPawnMoves(piece),
                ChessPieces.BlackPawn => GetPawnMoves(piece),
                ChessPieces.WhiteRook => GetRookMoves(piece),
                ChessPieces.BlackRook => GetRookMoves(piece),
                ChessPieces.WhiteBishop => GetBishopMoves(piece),
                ChessPieces.BlackBishop => GetBishopMoves(piece),
                ChessPieces.WhiteQueen => GetQueenMoves(piece),
                ChessPieces.BlackQueen => GetQueenMoves(piece),
                ChessPieces.WhiteKnight => GetKnightMoves(piece),
                ChessPieces.BlackKnight => GetKnightMoves(piece),
                ChessPieces.WhiteKing => GetKingMoves(piece),
                ChessPieces.BlackKing => GetKingMoves(piece),
                _ => Enumerable.Empty<Move>()
            };
public IEnumerable < Move > GetMoveOptions ( ChessPiece piece ) => piece ? . PieceType switch { ChessPieces . WhitePawn => GetPawnMoves ( piece ) , ChessPieces . BlackPawn => GetPawnMoves ( piece ) , ChessPieces . WhiteRook => GetRookMoves ( piece ) , ChessPieces . BlackRook => GetRookMoves ( piece ) , ChessPieces . WhiteBishop => GetBishopMoves ( piece ) , ChessPieces . BlackBishop => GetBishopMoves ( piece ) , ChessPieces . WhiteQueen => GetQueenMoves ( piece ) , ChessPieces . BlackQueen => GetQueenMoves ( piece ) , ChessPieces . WhiteKnight => GetKnightMoves ( piece ) , ChessPieces . BlackKnight => GetKnightMoves ( piece ) , ChessPieces . WhiteKing => GetKingMoves ( piece ) , ChessPieces . BlackKing => GetKingMoves ( piece ) , _ => Enumerable . Empty < Move > ( ) } ;
Returns all possible squares a piece can move to, not considering
whether the move is legal (due to check) or whether the move results
in check, checkmate, or an ambiguous move.
Returns all possible squares a piece can move to not considering whether the move is legal ( due to check ) or whether the move results in check checkmate or an ambiguous move .
A complete list of possible ending squares.
A complete list of possible ending squares .
piece
ChessPiece
The piece to move.
The piece to move .