def state2int(points_earned, distance_reward):
    """
    Helper function returns total reward for snake_game

        ate_food -> reward=2

        no_colition -> reward=distance_reward

        colision -> reward=-2

    :param points_earned: Points earned reported by SnakeGame
    :param distance_reward: Calculated with dp_reward
    :type points_earned: float
    :type distance_reward: float
    :return: Total reward
    :rtype: float or int
    """
    if points_earned == 0:
        return distance_reward
    elif points_earned < 0:
        return -2
    elif points_earned > 0:
        return 2
    return 0