How to use the magent.gridworld.CircleRange 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 / scripts / test_1m.py View on Github external
cfg.set({"map_width": 10000, "map_height": 10000})
    cfg.set({"minimap_mode": 0})
    cfg.set({"turn_mode": 0})
    cfg.set({"embedding_size": 8})

    deer = cfg.register_agent_type(
        name="deer",
        attr={'width': 1, 'length': 1, 'hp': 10, 'speed': 1,
              'view_range': gw.CircleRange(7), 'attack_range': gw.CircleRange(0),
              'damage': 0, 'step_recover': 0,   'kill_supply': 8})

    tiger = cfg.register_agent_type(
        name="tiger",
        attr={'width': 1, 'length': 1, 'hp': 10, 'speed': 1,
              'view_range': gw.CircleRange(6), 'attack_range': gw.CircleRange(2),
              'damage': 10, 'step_recover': -0.01,   'kill_supply': 0})

    deer_g = cfg.add_group(agent_type=deer)
    tiger_g = cfg.add_group(agent_type=tiger)

    '''
    a = gw.AgentSymbol(group=deer_g, index='any')
    b = gw.AgentSymbol(group=tiger_g, index='any')

    a_kill = gw.Event(a, 'kill', b)
    b_kill = gw.Event(b, 'kill', a)

    cfg.add_reward_rule(on=a_kill, receiver=[a, b], value=[1, -1])
    cfg.add_reward_rule(on=b_kill, receiver=[a, b], value=[-1, 1])
    '''
github geek-ai / MAgent / scripts / test_1m.py View on Github external
def load_forest():
    cfg = gw.Config()

    cfg.set({"map_width": 10000, "map_height": 10000})
    cfg.set({"minimap_mode": 0})
    cfg.set({"turn_mode": 0})
    cfg.set({"embedding_size": 8})

    deer = cfg.register_agent_type(
        name="deer",
        attr={'width': 1, 'length': 1, 'hp': 10, 'speed': 1,
              'view_range': gw.CircleRange(7), 'attack_range': gw.CircleRange(0),
              'damage': 0, 'step_recover': 0,   'kill_supply': 8})

    tiger = cfg.register_agent_type(
        name="tiger",
        attr={'width': 1, 'length': 1, 'hp': 10, 'speed': 1,
              'view_range': gw.CircleRange(6), 'attack_range': gw.CircleRange(2),
              'damage': 10, 'step_recover': -0.01,   'kill_supply': 0})

    deer_g = cfg.add_group(agent_type=deer)
    tiger_g = cfg.add_group(agent_type=tiger)

    '''
    a = gw.AgentSymbol(group=deer_g, index='any')
    b = gw.AgentSymbol(group=tiger_g, index='any')

    a_kill = gw.Event(a, 'kill', b)