play_human.py
def callback(s, s2, a, r, d, i) -> None:
    """
    Respond to the step callback in the play method.

    Args:
        s: the state before the action was fired
        s2: the state after the action was fired
        a: the action to fire
        r: the reward observed as a result of the action
        d: a flag denoting if the episode is over
        i: the information dictionary from the step

    Returns:
        None

    """

    global counter, game_played
    if counter % 4 == 0:
        dir_numpydata = '{}/{}/{}/'.format(output_dir,"game_"+str(game_played), "episode_"+str(counter))
        os.makedirs(dir_numpydata)
        with open(dir_numpydata + "state2.npy", "w") as f:
            np.save(dir_numpydata + "state2.npy", s2)
        with open(dir_numpydata + "action.npy", "w") as f:
            np.save(dir_numpydata + "action.npy", np.array(a))
        with open(dir_numpydata + "reward.npy", "w") as f:
            np.save(dir_numpydata + "reward.npy", np.array(r))
    counter += 1

    if d:
        counter = 0
        game_played += 1

    Respond to the step callback in the play method.

    Args:
        s: the state before the action was fired
        s2: the state after the action was fired
        a: the action to fire
        r: the reward observed as a result of the action
        d: a flag denoting if the episode is over
        i: the information dictionary from the step

    Returns:
        None

    
Respond to the step callback in the play method.
Respond to the step callback in the play method .
def callback(s, s2, a, r, d, i) -> None:
    global counter, game_played
    if counter % 4 == 0:
        dir_numpydata = '{}/{}/{}/'.format(output_dir,"game_"+str(game_played), "episode_"+str(counter))
        os.makedirs(dir_numpydata)
        with open(dir_numpydata + "state2.npy", "w") as f:
            np.save(dir_numpydata + "state2.npy", s2)
        with open(dir_numpydata + "action.npy", "w") as f:
            np.save(dir_numpydata + "action.npy", np.array(a))
        with open(dir_numpydata + "reward.npy", "w") as f:
            np.save(dir_numpydata + "reward.npy", np.array(r))
    counter += 1
    if d:
        counter = 0
        game_played += 1
def callback ( s , s2 , a , r , d , i ) -> None : global counter , game_played if counter % 4 == 0 : dir_numpydata = '{}/{}/{}/' . format ( output_dir , "game_" + str ( game_played ) , "episode_" + str ( counter ) ) os . makedirs ( dir_numpydata ) with open ( dir_numpydata + "state2.npy" , "w" ) as f : np . save ( dir_numpydata + "state2.npy" , s2 ) with open ( dir_numpydata + "action.npy" , "w" ) as f : np . save ( dir_numpydata + "action.npy" , np . array ( a ) ) with open ( dir_numpydata + "reward.npy" , "w" ) as f : np . save ( dir_numpydata + "reward.npy" , np . array ( r ) ) counter += 1 if d : counter = 0 game_played += 1
Respond to the step callback in the play method.
Respond to the step callback in the play method .
"""
    Respond to the step callback in the play method.

    Args:
        s: the state before the action was fired
        s2: the state after the action was fired
        a: the action to fire
        r: the reward observed as a result of the action
        d: a flag denoting if the episode is over
        i: the information dictionary from the step

    Returns:
        None

    """
None
s
the state before the action was fired
the state before the action was fired
s2
the state after the action was fired
the state after the action was fired
a
the action to fire
the action to fire
r
the reward observed as a result of the action
the reward observed as a result of the action
d
a flag denoting if the episode is over
a flag denoting if the episode is over
i
the information dictionary from the step
the information dictionary from the step