0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OpenAI GYMでFrozen Lakeをrenderする際のエラー解決方法

Last updated at Posted at 2024-05-03

Frozen Lakeをrenderする際に下記エラーが発生する。

elf_img = pygame.transform.scale(elf_img, elf_dims)
TypeError: integer argument expected, got float

下記のようにFrozenLakeの元ファイルの302-303行目をintでキャストすることで解決する。

\gym\envs\toy_text\frozen_lake.py
# prepare images
last_action = self.lastaction if self.lastaction is not None else 1
elf_img = self.elf_images[last_action]
elf_scale = min(
-    small_cell_w / elf_img.get_width(),
+    int(small_cell_w / elf_img.get_width()),
-    small_cell_h / elf_img.get_height(),
+    int(small_cell_h / elf_img.get_height()),
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?