Exemplo n.º 1
0
    def get_game_info(self, player_id):
        game_info = AttrDict()

        game_info.robots = dict((loc, AttrDict(robot))
                                for loc, robot in self.robots.iteritems())
        for robot in game_info.robots.itervalues():
            if robot.player_id != player_id:
                del robot.robot_id

        game_info.turn = self.turn

        return game_info
Exemplo n.º 2
0
    def get_game_info(self, player_id):
        game_info = AttrDict()

        game_info.robots = dict(
            (loc, AttrDict(robot)) for loc, robot in self.robots.iteritems())
        for robot in game_info.robots.itervalues():
            if robot.player_id != player_id:
                del robot.robot_id

        game_info.turn = self.turn

        return game_info
Exemplo n.º 3
0
    def get_game_info(self, player_id=None, json=None, seed=None):
        game_info = AttrDict()

        if json:
            game_info.robots = list(self.robots.values())
        else:
            game_info.robots = dict((loc, AttrDict(robot))
                                    for loc, robot in self.robots.items())

        if player_id is not None:
            for robot in game_info.robots.values():
                if robot.player_id != player_id:
                    del robot.robot_id

        if seed:
            game_info.seed = self._seed

        game_info.turn = self.turn
        if json:
            game_info.turn = str(game_info.turn)

        return game_info