コード例 #1
0
ファイル: gamestate.py プロジェクト: DynCodingForKids/rgkit
    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
コード例 #2
0
ファイル: gamestate.py プロジェクト: ramk13/rgkit
    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
コード例 #3
0
ファイル: gamestate.py プロジェクト: arewera290601/mojprojekt
    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