コード例 #1
0
ファイル: __init__.py プロジェクト: Onapsis/pywars
def run_match(p1_script, p2_script, p1_name="user1", p2_name="user2"):
    print "GOT PARAMS: ", p1_script, p2_script, p1_name, p2_name
    bots = [BotPlayer(p1_name, p1_script),
            BotPlayer(p2_name, p2_script)]

    pywars_game = PyWarsGameController(bots)
    for b in bots:
        pywars_game.add_player(b.username, b.script)
    pywars_game.run()

    return pywars_game.json_game_output()
コード例 #2
0
ファイル: test_run.py プロジェクト: Onapsis/pywars
def main(argv):
    bot1_username = "******"
    bot2_username = "******"
    bots = [BotPlayer(bot1_username, argv[0]),
            BotPlayer(bot2_username, argv[1])]

    pywars_game = PyWarsGameController(bots)
    for b in bots:
        pywars_game.add_player(b.username, b.script)
    pywars_game.run()

    json_data = pywars_game.json_game_output()
    print(json_data)

    sys.exit(0)