def update_d(
    r: str,
    d: int,
    ) -> int:
    """Update the direction

    Parameters
    ----------
    r : str
        The direction of rotation
    d : int
        The current direction

    Returns
    -------
    int
        The updated direction
    """
    
    #   Check if the direction of rotation is 45 degrees positive
    if r == "+":
        d += 45

    #   Check if the direction of rotation is 45 degrees negative
    elif r == "-":
        d -= 45
    
    #   Check if the direction is more than 360 degrees
    if d >= 360:
        d -=360

    #   Check if the direction is less than 0 degrees
    elif d < 0:
        d += 360

    return d