def get_cart_location(env, screen_width=600):
    """
    Get the position of cart
    :param env: environment, in this file means cartpole-v0
    :param screen_width:screen width defined in gym
    :return:middle position of cart
    """
    world_width = env.x_threshold * 2
    scale = screen_width / world_width
    return int(env.state[0] * scale + screen_width / 2.0)