Giter Club home page Giter Club logo

mazelab's Issues

[Bug] Blurry Rendering of Environment

Hi,

I was running through the examples you have provided and attempted to render the the empty maze environment. However, the resulting image is oddly blurry as attached. Would you know the reason as to why and if there are any fixes?

image

Thank you!

TypeError: namedtuple() got an unexpected keyword argument 'defaults'

Following the jupyter notebook, I'm getting the above error when running the line:
from mazelab import BaseMaze

TypeError Traceback (most recent call last)
in
1 import numpy as np
----> 2 from mazelab import BaseMaze
3 from mazelab import Object
4 from mazelab import DeepMindColor as color
5

~/anaconda3/envs/slime/mazelab/mazelab/init.py in
3 from .object import Object
4
----> 5 from .motion import VonNeumannMotion
6 from .motion import MooreMotion
7

~/anaconda3/envs/slime/mazelab/mazelab/motion.py in
4 VonNeumannMotion = namedtuple('VonNeumannMotion',
5 ['north', 'south', 'west', 'east'],
----> 6 defaults=[[-1, 0], [1, 0], [0, -1], [0, 1]])
7
8

TypeError: namedtuple() got an unexpected keyword argument 'defaults'

Bugs in passable check in _is_valid() method of Maze object

It seems that negative or out of edge position will result index error in _is_valid() method, because of the passable check.
I think it should be changed to
def _is_valid(self, position):
nonnegative = position[0] >= 0 and position[1] >= 0
within_edge = position[0] < self.maze.size[0] and position[1] < self.maze.size[1]
if (nonnegative and within_edge):
passable = not self.maze.to_impassable()[position[0]][position[1]]
else:
passable = False
return nonnegative and within_edge and passable


IndexError Traceback (most recent call last)
in
35 action = agent.act(state, epsilon)
36
---> 37 _, reward, done, _ = env.step(action)
38 next_state = env.unwrapped.maze.objects.agent.positions[0]
39

//anaconda3/lib/python3.7/site-packages/gym/wrappers/time_limit.py in step(self, action)
14 def step(self, action):
15 assert self._elapsed_steps is not None, "Cannot call env.step() before calling reset()"
---> 16 observation, reward, done, info = self.env.step(action)
17 self._elapsed_steps += 1
18 if self._elapsed_steps >= self._max_episode_steps:

in step(self, action)
21 current_position = self.maze.objects.agent.positions[0]
22 new_position = [current_position[0] + motion[0], current_position[1] + motion[1]]
---> 23 valid = self._is_valid(new_position)
24 if valid:
25 self.maze.objects.agent.positions = [new_position]

in _is_valid(self, position)
44 nonnegative = position[0] >= 0 and position[1] >= 0
45 within_edge = position[0] < self.maze.size[0] and position[1] < self.maze.size[1]
---> 46 passable = not self.maze.to_impassable()[position[0]][position[1]]
47 return nonnegative and within_edge and passable
48

IndexError: index 6 is out of bounds for axis 0 with size 6

env.reset() doesn't work

when running

from gym_maze.envs import MazeEnv
from gym_maze.envs.generators import *
maze = RandomBlockMazeGenerator(maze_size=4, obstacle_ratio=0.0)
env = MazeEnv(maze)
env.reset()

I get the following error:

Traceback (most recent call last):
WARN: gym.spaces.Box autodetected dtype as <class 'numpy.float32'>. Please provide explicit dtype.  File "C:/Users/Yitzhak/Projects/gym-maze/example_1.py", line 5, in <module>
    env.reset()
  File "C:\Users\Yitzhak\Anaconda3\lib\site-packages\gym\core.py", line 71, in reset
    raise NotImplementedError
NotImplementedError

Track of updates for new release

  • Use ImageViewer from lagom to display observation, do not use saving list of arrays, it is too slow.
  • Synchronize some tricks from lagom
  • Redesign classes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.