Browse Source

fix Grid.rotate_left for non-square grids (#33)

A. Baisero 6 years ago
parent
commit
02bc4b8cf8
1 changed files with 5 additions and 5 deletions
  1. 5 5
      gym_minigrid/minigrid.py

+ 5 - 5
gym_minigrid/minigrid.py

@@ -469,12 +469,12 @@ class Grid:
         Rotate the grid to the left (counter-clockwise)
         """
 
-        grid = Grid(self.width, self.height)
+        grid = Grid(self.height, self.width)
 
-        for j in range(0, self.height):
-            for i in range(0, self.width):
-                v = self.get(self.width - 1 - j, i)
-                grid.set(i, j, v)
+        for i in range(self.width):
+            for j in range(self.height):
+                v = self.get(i, j)
+                grid.set(j, grid.height - 1 - i, v)
 
         return grid