def cap_angle(self, x, a, b):
    penalty = 10
    if (x < a):
        self.penalty += penalty
        x = a
    elif (x > b):
        self.penalty += penalty
        x = b
    return x
def cap_angle(self, x, a, b):
    penalty = 10
    if (x < a):
        self.penalty += penalty
        x = a
    elif (x > b):
        self.penalty += penalty
        x = b
    return x