def __init__(self, display=None, board_size=13, agents=[], partially_observable=False, game_type=None): super().__init__() self.display = rendering.get_display(display) board_height = constants.TILE_SIZE * board_size height = math.ceil(board_height + (constants.BORDER_SIZE * 2) + (constants.MARGIN_SIZE * 3)) width = math.ceil(board_height + board_height / 4 + (constants.BORDER_SIZE * 2) + constants.MARGIN_SIZE) self._height = height self._width = width self.window = pyglet.window.Window(width=width, height=height, display=display) self.window.set_caption('Pommerman') self.isopen = True self._board_size = board_size self._resource_manager = ResourceManager() self._tile_size = constants.TILE_SIZE self._agent_tile_size = (board_height / 4) / board_size self._agent_count = len(agents) self._agents = agents self._game_type = game_type self._is_partially_observable = partially_observable @self.window.event def close(self): self.window.close() self.isopen = False
def __init__(self, display=None, board_size=13, agents=[], partially_observable=False, game_type=None): super().__init__() self.display = rendering.get_display(display) self._board_size = board_size self._agent_count = len(agents) self._agents = agents self._is_partially_observable = partially_observable
def __init__(self, display=None, board_size=11, agents=[], partially_observable=False, agent_view_size=None, game_type=None): super().__init__() from gym.envs.classic_control import rendering self.display = rendering.get_display(display) self._board_size = board_size self._agent_count = len(agents) self._agents = agents self._is_partially_observable = partially_observable self._agent_view_size = agent_view_size
def __init__( self, display=None, board_size=11, agents=[], partially_observable=False, agent_view_size=None, game_type=None, ): super().__init__() from gym.envs.classic_control import rendering self.display = rendering.get_display(display) board_height = constants.TILE_SIZE * board_size height = math.ceil(board_height + (constants.BORDER_SIZE * 2) + (constants.MARGIN_SIZE * 3)) ability_width = constants.TILE_SIZE * 2 width = math.ceil(board_height + ability_width + (constants.BORDER_SIZE * 2) + constants.MARGIN_SIZE) # board_height + (constants.BORDER_SIZE * 2) self._height = height self._width = width self.window = pyglet.window.Window(width=width, height=height, display=display) self.window.set_caption('Pommerman') self.isopen = True self._board_size = board_size self._resource_manager = ResourceManager(game_type) self._tile_size = constants.TILE_SIZE self._agent_tile_size = (board_height / 4) / board_size self._agent_abilities_size = constants.TILE_SIZE * 2 self._agent_count = len(agents) self._agents = agents self._game_type = game_type self._is_partially_observable = partially_observable self._agent_view_size = agent_view_size @self.window.event def close(self): '''Pyglet event handler to close the window''' self.window.close() self.isopen = False