def run_episode(for_training):
    """
        Runs one episode
        If for training, update Q function
        If for testing, computes and return cumulative discounted reward
    """
    epsilon = TRAINING_EP if for_training else TESTING_EP

    # initialize for each episode
    i = 0
    epi_reward = 0
    (current_room_desc, current_quest_desc, terminal) = framework.newGame()