def discretize_state(state, env):
    """discretize agent state
    Parameters
    ------------
    state : list
    env : gym class
    Returns
    --------
    position : int
    velocity : int
    """
    state_num = 40
    env_low = env.observation_space.low # 位置と速度の最小値
    env_high = env.observation_space.high #　位置と速度の最大値
    env_dx = (env_high - env_low) / state_num # 40等分
    # 0〜39の離散値に変換する
    position = int((state[0] - env_low[0])/env_dx[0])
    velocity = int((state[1] - env_low[1])/env_dx[1])

    return [position, velocity]