How to use the magent.utility.FontProvider function in magent

To help you get started, we’ve selected a few magent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github geek-ai / MAgent / examples / train_arrange.py View on Github external
def generate_map(env, map_size, goal_handle, handles, rnd):
    # random message
    font = FontProvider('data/font_8x8/basic.txt')
    n_msg = random.randint(1, 4)
    messages = []
    for i in range(n_msg):
        length = random.randint(2, 9)
        tmp = []
        for j in range(length):
            tmp.append(random.randint(0x20, 0x7E))
        messages.append(tmp)

    center_x, center_y = map_size // 2, map_size // 2

    # create maze: left pos, width, height
    radius = 90
    pos_list = create_maze([center_x - radius, center_y - radius], radius + 1, 15, 2, font_area=[radius * 2 - 28, radius * 2 - 28])
    # pos_list = create_naive_maze([center_x - radius, center_y - radius], radius + 1, 15, 2, font_area=[radius * 2 - 28, radius * 2 - 28])
    env.add_walls(method="custom", pos=pos_list)
github geek-ai / MAgent / train_arrange.py View on Github external
def generate_map(env, map_size, goal_handle, handles):
    # random message
    font = FontProvider('data/font_8x8/basic.txt')
    n_msg = random.randint(1, 4)
    messages = []
    for i in range(n_msg):
        length = random.randint(2, 9)
        tmp = []
        for j in range(length):
            tmp.append(random.randint(0x20, 0x7E))
        messages.append(tmp)

    center_x, center_y = map_size // 2, map_size // 2

    # create maze: left pos, width, height
    radius = 90
    pos_list = create_maze([center_x - radius, center_y - radius], radius + 1, 15, 2, font_area=[radius * 2 - 28, radius * 2 - 28])
    env.add_walls(method="custom", pos=pos_list)
github geek-ai / MAgent / python / magent / renderer / server / arrange_server.py View on Github external
def __init__(self, path="data/arrange_model", messages=None, mode=1):
        # some parameter
        map_size = 250
        eps = 0.15

        # init the game
        env = magent.GridWorld(load_config(map_size))
        font = FontProvider('data/font_8x8/basic.txt')

        handles = env.get_handles()
        food_handle, handles = handles[0], handles[1:]
        models = []
        models.append(DeepQNetwork(env, handles[0], 'arrange', use_conv=True))

        # load model
        models[0].load(path, 10)

        # init environment
        env.reset()
        generate_map(mode, env, map_size, food_handle, handles, messages, font)

        # save to member variable
        self.env = env
        self.food_handle = food_handle