Farama-Foundation / gym-examples

Example code for the Gym documentation
71 stars 51 forks source link

Update grid_world.py #4

Closed Niko-creater closed 2 years ago

Niko-creater commented 2 years ago

When I try to run the codes, it reports the error "AssertionError: The observation returned by the reset() method is not contained with the observation space (Dict(agent: Box(0, 4, (2,), int32), target: Box(0, 4, (2,), int32)))". So after checking the "reset" function and I found the solution: add 'dtype=int' to 'np_random.integers'

I'm new to the github and I'm not very familiar with it, also I'm not quite sure if such small problem deserve a pull request. So please notice or even criticize me if I doing something wrong.

Markus28 commented 2 years ago

Hey, thanks a lot for the PR, you are doing great ;)! Looks good to merge.

I expect that this particular issue only pops up on Windows or 32bit systems, at least I am getting int64s in my observation space.

The AssertionError is probably thrown by the env checker, which will (hopefully) be fixed in the upcoming Gym release. Until then, you can use gym.make("gym_examples/GridWorld-v0", disable_env_checker=True) for issues like this (I was also getting an error in step).

Niko-creater commented 2 years ago

Thank you for your detailed reply and disable_env_checker=True is very useful.! Actually I also encountered error instep function and I had to modify the space.dict observation_space to single space.box type. Hope the problem of env checker could be fixed in upcoming release;)

Hey, thanks a lot for the PR, you are doing great ;)! Looks good to merge.

I expect that this particular issue only pops up on Windows or 32bit systems, at least I am getting int64s in my observation space.

The AssertionError is probably thrown by the env checker, which will (hopefully) be fixed in the upcoming Gym release. Until then, you can use gym.make("gym_examples/GridWorld-v0", disable_env_checker=True) for issues like this (I was also getting an error in step).