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 bool IsValidMove(Vector2D toPosition) { bool isValid = false; var pieceAtToPosition = ChessGame.ChessBoard.Board[toPosition.Y, toPosition.X]; if ((MovementValidation.IsValidBishopMovement(BoardPosition, toPosition) || MovementValidation.IsValidRookMovement(BoardPosition, toPosition)) && !(pieceAtToPosition != null && pieceAtToPosition.GetType() == typeof(King))) { int xDiff = Math.Abs(BoardPosition.X - toPosition.X); int yDiff = Math.Abs(BoardPosition.Y - toPosition.Y); isValid = ((xDiff == 0 || xDiff == 1) && (yDiff == 0 || yDiff == 1)); } return(isValid); }