Esempio n. 1
0
def simulate_battle(map_segment, attackradius2, attack_method):
    # add buffer so that battles aren't affected by wrapping
    #buffer = int(sqrt(attackradius2)) + 1
    buffer = 0

    map_data = create_map_data(map_segment, buffer)

    game = Ants({
        'attackradius2': attackradius2,
        'map': map_data,
        'attack': attack_method,
        # the rest of these options don't matter
        'loadtime': 0,
        'turntime': 0,
        'viewradius2': 100,
        'spawnradius2': 2,
        'turns': 1
    })
    game.do_attack()

    # Figure out what number we labeled each character
    a = 0
    b = 0
    #print game.player_chars
    if 'a' in game.player_chars:
        a = len(game.player_ants(game.player_chars.index('a')))
    if 'b' in game.player_chars:
        b = len(game.player_ants(game.player_chars.index('b')))

    # remove buffer and return
    return (create_map_output(game.map, buffer), (a,b))
Esempio n. 2
0
def simulate_battle(map_segment, attackradius2, attack_method):
    # add buffer so that battles aren't affected by wrapping
    buffer = int(sqrt(attackradius2)) + 1

    map_data = create_map_data(map_segment, buffer)

    game = Ants({
        'attackradius2': attackradius2,
        'map': map_data,
        'attack': attack_method,
        # the rest of these options don't matter
        'loadtime': 0,
        'turntime': 0,
        'viewradius2': 100,
        'spawnradius2': 2,
        'turns': 1
    })
    game.do_attack()

    # remove buffer and return
    return create_map_output(game.map, buffer)
Esempio n. 3
0
def simulate_battle(map_segment, attackradius2, attack_method):
    # add buffer so that battles aren't affected by wrapping
    buffer = int(sqrt(attackradius2)) + 1

    map_data = create_map_data(map_segment, buffer)

    game = Ants({
        'attackradius2': attackradius2,
        'map': map_data,
        'attack': attack_method,
        # the rest of these options don't matter
        'loadtime': 0,
        'turntime': 0,
        'viewradius2': 100,
        'spawnradius2': 2,
        'turns': 1
    })
    game.do_attack()

    # remove buffer and return
    return create_map_output(game.map, buffer)