(network, id=False, ui_en=False)
Description: This replays a particular match  
    Arguments:  
    * network: An `network`(pommerman.network.ion_client.network) object  
    * id: The ID of a match to be played. If False, the user is prompted about \
it.  
    * ui_en: If the UI is enabled or disabled (This also controls if exception are\
raised or not)
Description: This replays a particular match  
    Arguments:  
    * network: An `network`(pommerman.network.ion_client.network) object  
    * id: The ID of a match to be played. If False, the user is prompted about \
it.  
    * ui_en: If the UI is enabled or disabled (This also controls if exception are\
raised or not)
Description : This replays a particular match Arguments : * network : An network ( pommerman . network . ion_client . network ) object * id : The ID of a match to be played . If False the user is prompted about \ it . * ui_en : If the UI is enabled or disabled ( This also controls if exception are \ raised or not )
def replay(network, id=False, ui_en=False):
    """Description: This replays a particular match  
    Arguments:  
    * network: An `network`(pommerman.network.ion_client.network) object  
    * id: The ID of a match to be played. If False, the user is prompted about \
it.  
    * ui_en: If the UI is enabled or disabled (This also controls if exception are\
raised or not)"""
    if not id and ui_en:
        id = ui.ask_string(constants.Strings.replay_prompt.value)
        if id is None:
            ui.fatal(constants.Strings.error_invalid_id.value)
        id = str(id)
    if id[0] == "#":
        id = id[1:]
    ui.info(
        constants.Strings.server_replay_p1.value,
        ui.yellow,
        "#" + str(id),
        ui.reset,
        constants.Strings.server_replay_p2.value,
    )
    try:
        replay_obj = network.get_replay(id)
    except Exception as e:
        if ui_en:
            ui.fatal(e)
        raise e
    if ui_en:
        ui.info(constants.Strings.replay_start.value, ui.yellow, "#" + str(id))
    env = pommerman.make(
        replay_obj["mode"],
        [
            pommerman.agents.BaseAgent(),
            pommerman.agents.BaseAgent(),
            pommerman.agents.BaseAgent(),
            pommerman.agents.BaseAgent(),
        ],
    )
    env.reset()
    env._board = numpy.array(replay_obj["board"])
    # Note: Render FPS is set to 30 as it'll be smoother
    env._render_fps = 30
    for i in replay_obj["actions"]:
        env.render()
        reward, done = env.step(i)[1:3]
        if done:
            break
    if reward != replay_obj["reward"]:
        if ui_en:
            ui.info(ui.yellow, constants.Exceptions.replay_no_reward.value)
        else:
            raise Exception(constants.Exceptions.replay_no_reward.value)
    env.close()
    if ui_en:
        ui.info(ui.yellow, constants.Strings.replay_end.value)
    intent(network)
def replay ( network , id = False , ui_en = False ) : if not id and ui_en : id = ui . ask_string ( constants . Strings . replay_prompt . value ) if id is None : ui . fatal ( constants . Strings . error_invalid_id . value ) id = str ( id ) if id [ 0 ] == "#" : id = id [ 1 : ] ui . info ( constants . Strings . server_replay_p1 . value , ui . yellow , "#" + str ( id ) , ui . reset , constants . Strings . server_replay_p2 . value , ) try : replay_obj = network . get_replay ( id ) except Exception as e : if ui_en : ui . fatal ( e ) raise e if ui_en : ui . info ( constants . Strings . replay_start . value , ui . yellow , "#" + str ( id ) ) env = pommerman . make ( replay_obj [ "mode" ] , [ pommerman . agents . BaseAgent ( ) , pommerman . agents . BaseAgent ( ) , pommerman . agents . BaseAgent ( ) , pommerman . agents . BaseAgent ( ) , ] , ) env . reset ( ) env . _board = numpy . array ( replay_obj [ "board" ] ) # Note: Render FPS is set to 30 as it'll be smoother env . _render_fps = 30 for i in replay_obj [ "actions" ] : env . render ( ) reward , done = env . step ( i ) [ 1 : 3 ] if done : break if reward != replay_obj [ "reward" ] : if ui_en : ui . info ( ui . yellow , constants . Exceptions . replay_no_reward . value ) else : raise Exception ( constants . Exceptions . replay_no_reward . value ) env . close ( ) if ui_en : ui . info ( ui . yellow , constants . Strings . replay_end . value ) intent ( network )