Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions gym/envs/toy_text/frozen_lake.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,11 @@ def _render_gui(self, desc, mode):
]
self.elf_images = [pygame.image.load(f_name) for f_name in elfs]

board = pygame.Surface(self.window_size, flags=SRCALPHA)
cell_width = self.window_size[0] // self.ncol
cell_height = self.window_size[1] // self.nrow
smaller_cell_scale = 0.6
small_cell_w = smaller_cell_scale * cell_width
small_cell_h = smaller_cell_scale * cell_height
small_cell_w = int(smaller_cell_scale * cell_width)
small_cell_h = int(smaller_cell_scale * cell_height)

# prepare images
last_action = self.lastaction if self.lastaction is not None else 1
Expand Down Expand Up @@ -319,7 +318,7 @@ def _render_gui(self, desc, mode):
else:
self.window_surface.blit(ice_img, (rect[0], rect[1]))

pygame.draw.rect(board, (180, 200, 230), rect, 1)
pygame.draw.rect(self.window_surface, (180, 200, 230), rect, 1)

# paint the elf
bot_row, bot_col = self.s // self.ncol, self.s % self.ncol
Expand All @@ -335,7 +334,6 @@ def _render_gui(self, desc, mode):
elf_rect = self._center_small_rect(cell_rect, elf_img.get_size())
self.window_surface.blit(elf_img, elf_rect)

self.window_surface.blit(board, board.get_rect())
if mode == "human":
pygame.event.pump()
pygame.display.update()
Expand Down