Open tessavdheiden opened 4 years ago
Hi Tessa, thanks! That's a nice idea. I created a class called MazeWorld
encoding the grid-world environment, but of course, the empowerment calculation is general and you can implement whatever environment you wish. That said, currently the MazeWorld
object is mutable, with an add_wall
method. To get the walls to move dynamically, we could create a remove_wall
method and potentially a move_wall
method (making use of remove and add), and use these methods to change the MazeWorld object dynamically.
Yes, something like this below? But where to put it, in the act()
?
def remove_wall(self, cell, direction): self.adjacencies[cell[0]][cell[1]].append(direction)
new_cell = cell + self.actions[direction]
self.adjacencies[new_cell[0]][new_cell[1]].append(self.opposite[direction])
# remove wall for plotting
self.walls.remove((cell, new_cell))
def move_wall(self, cell, direction, move): self.remove_wall(cell, direction) new_cell = cell + self.actions[move] self.add_wall(new_cell, direction)
Those functions look great, and can be added as methods of MazeWorld (just like add_wall
). You can then call them when you build your own dynamically moving maze world (you'll probably have to define your own functions / classes to control the dynamic changes). For examples of building static ones, there are a bunch of functions at the end of mazeworld.py that take no arguments and return fixed MazeWorld objects.
I would happily accept a PR with those changes
Hi Chris! Nice work. Have you also considered adding moving objects? For instance, the walls move?