def shoot_error(x_target, x):
    """
    calculates the error of a shoot on the target at x_target.
    :param x_target: position of the target
    :param x: state array holding the complete history of the shoot
    :return: error. A positive sign of the error indicates that the shoot has been to far, a negative sign that it has
    been to short.
    """
    # ==============================================================================
    #
    # ==============================================================================
    x_hit = x[0, -1]  # access last element from the state array and get x position
    error = x_hit - x_target
    return error