DoubleGremlin181 / RubiksCubeGym

OpenAI Gym environments for various twisty puzzles
MIT License
35 stars 7 forks source link

RubiksCube222EnvLBL.reset() got an unexpected keyword argument 'scramble' #6

Open albert-queralto opened 7 months ago

albert-queralto commented 7 months ago

Good evening, I was checking the boilerplate code in the documentation page and I receive this error in the reset method:

`TypeError Traceback (most recent call last) Cell In[5], line 5 2 import rubiks_cube_gym
4 env = gym.make('rubiks-cube-222-lbl-v0')
----> 5 env.reset(scramble="R U R' U' R' F R2 U' R' U' R U R' F'")
7 for _ in range(4):
8 env.render()

File /usr/local/lib/python3.10/dist-packages/gymnasium/wrappers/time_limit.py:75, in TimeLimit.reset(self, kwargs) 66 """Resets the environment with :param:`kwargs` and sets the number of steps elapsed to zero. 67 68 Args: (...) 72 The reset environment 73 """ 74 self._elapsed_steps = 0 ---> 75 return self.env.reset(**kwargs)

File /usr/local/lib/python3.10/dist-packages/gymnasium/wrappers/order_enforcing.py:61, in OrderEnforcing.reset(self, kwargs) 59 """Resets the environment with kwargs.""" 60 self._has_reset = True ---> 61 return self.env.reset(kwargs)

File /usr/local/lib/python3.10/dist-packages/gymnasium/wrappers/env_checker.py:57, in PassiveEnvChecker.reset(self, kwargs) 55 if not self.checked_reset: 56 self.checked_reset = True ---> 57 return env_reset_passive_checker(self.env, kwargs) 58 else: 59 return self.env.reset(**kwargs)

File /usr/local/lib/python3.10/dist-packages/gymnasium/utils/passive_env_checker.py:186, in env_reset_passive_checker(env, kwargs) 181 logger.deprecation( 182 "Current gymnasium version requires that Env.reset can be passed options to allow the environment initialisation to be passed additional information." 183 ) 185 # Checks the result of env.reset with kwargs --> 186 result = env.reset(kwargs) 188 if not isinstance(result, tuple): 189 logger.warn( 190 f"The result returned by env.reset() was not a tuple of the form (obs, info), where obs is a observation and info is a dictionary containing additional information. Actual type: {type(result)}" 191 )

TypeError: RubiksCube222EnvLBL.reset() got an unexpected keyword argument 'scramble'` I am using gymnasium version 0.29.1. If I remove the 'scramble' from the code it runs fine. How could this be fixed?

Thank you very much.

albert-queralto commented 7 months ago

Well, looking at the code I found that the example in the documentation should be fixed as the correct line of code should be: options={"scramble": "R U R' U' R' F R2 U' R' U' R U R' F'"}. With this change, this part of the code works as expected.