def evaluate_training_result(env, agent, num_episode):
    """
    Evaluates the performance of the current DQN agent by using it to play a
    few episodes of the game and then calculates the average reward it gets.
    The higher the average reward is the better the DQN agent performs.
    :param num_episode: number of episodes
    :param env: the game environment
    :param agent: the DQN agent
    :return: average reward across episodes
    """
    total_reward = 0
    episodes_to_play = num_episode
    for i in range(episodes_to_play):
        current_obs = env.reset(day=i)
        finish = False
        episode_reward = 0
        while not finish:
            action = agent.action(current_obs)
            current_obs, next_obs, reward, finish = env.step(action)
            episode_reward += reward
            current_obs = next_obs
        total_reward += episode_reward
    average_reward = total_reward / episodes_to_play
    return average_reward