Esempio n. 1
0
    def run(self, game_num=None):

        game = Brisk(game_num, TEAM_NAME)
        print "starting game {} we are player {}".format(game.game_id, game.player_id)

        while True:
            status = self.await_turn_and_get_status(game)
            if status['eliminated']:
                print "we lost :-("
                break
            if status['winner']:
                if status['winner'] == game.player_id:
                    print "we won :-)"
                    res = game.reward()
                    print "send attachments to {}".format(res['upload_email'])
                else:
                    print "We lost without getting eliminated. Guess we timed out"
                break
            print "We survived to {} turns!".format(status['turns_taken'])
            lucky_territory = random.randint(0, len(status['territories']) - 1)
            game.place_armies(status['territories'][lucky_territory]['territory'], status['num_reserves'])
            game.end_turn()