public override bool IsValidMove(Vector2D toPosition) { bool validBishop = MovementValidation.IsValidBishopMovement(BoardPosition, toPosition); bool pathNotObstructed = MovementValidation.IsPathNotObstructed(BoardPosition, toPosition); return(validBishop && pathNotObstructed); }
public virtual List <Vector2D> GetPossibleMoves() { List <Vector2D> possibleMoves = new List <Vector2D>(); for (int y = 0; y < ChessBoard.Height; y++) { for (int x = 0; x < ChessBoard.Width; x++) { Vector2D currentCheck = new Vector2D(x, y); ChessPiece pieceAtCheck = ChessGame.ChessBoard.Board[currentCheck.Y, currentCheck.X]; //if (currentCheck.ToCoordinate() == "g1") Debugger.Break(); bool isPieceKing = (pieceAtCheck != null && pieceAtCheck.GetType() == typeof(King)); bool isValidMove = IsValidMove(currentCheck); bool pathNotObstructed = MovementValidation.IsPathNotObstructed(BoardPosition, currentCheck); bool pieceIsValid = (pieceAtCheck == null || (pieceAtCheck != null && PieceType != pieceAtCheck.PieceType)); if (isValidMove && pathNotObstructed && pieceIsValid && !isPieceKing) { possibleMoves.Add(currentCheck); } } } return(possibleMoves); }
public override bool IsValidMove(Vector2D toPosition) { bool isValidRook = MovementValidation.IsValidRookMovement(BoardPosition, toPosition); //if (toPosition.ToCoordinate() == "g1") Debugger.Break(); bool isNotObstructed = MovementValidation.IsPathNotObstructed(BoardPosition, toPosition); return(isValidRook && isNotObstructed); }
public override bool IsValidMove(Vector2D toPosition) { bool isValidRook = MovementValidation.IsValidRookMovement(BoardPosition, toPosition); bool isValidBishop = MovementValidation.IsValidBishopMovement(BoardPosition, toPosition); bool isNotObstructed = MovementValidation.IsPathNotObstructed(BoardPosition, toPosition); return((isValidRook || isValidBishop) && isNotObstructed); }
public override List <Vector2D> GetPossibleMoves() { List <Vector2D> baseMoves = base.GetPossibleMoves(); List <Vector2D> validMoves = new List <Vector2D>(); foreach (Vector2D move in baseMoves) { bool validMove = IsValidMove(move); bool pathNotObstructed = MovementValidation.IsPathNotObstructed(BoardPosition, move); if (validMove && pathNotObstructed) { validMoves.Add(move); } } return(validMoves); }