malmo.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:malmo-challenge 作者: Kaixhin 项目源码 文件源码
def allocate_remotes(remotes):
    """
    Utility method for building a Malmo ClientPool.
    Using this method allows sharing the same ClientPool across
    mutiple experiment
    :param remotes: tuple or array of tuples. Each tuple can be (), (ip,), (ip, port)
    :return: Malmo ClientPool with all registered clients
    """
    if not isinstance(remotes, list):
        remotes = [remotes]

    pool = ClientPool()
    for remote in remotes:
        if isinstance(remote, ClientInfo):
            pool.add(remote)
        elif isinstance(remote, Sequence):
            if len(remote) == 0:
                pool.add(ClientInfo('localhost', 10000))
            elif len(remote) == 1:
                pool.add(ClientInfo(remote[0], 10000))
            else:
                pool.add(ClientInfo(remote[0], int(remote[1])))
    return pool
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号