added benchmark task Crafter

This commit is contained in:
NM512
2023-06-18 00:02:22 +09:00
parent 9c58ab62c0
commit 5dce8cf13b
6 changed files with 111 additions and 5 deletions

View File

@@ -179,18 +179,22 @@ class RewardObs:
@property
def observation_space(self):
spaces = self._env.observation_space.spaces
assert "reward" not in spaces
spaces["reward"] = gym.spaces.Box(-np.inf, np.inf, shape=(1,), dtype=np.float32)
if "reward" not in spaces:
spaces["reward"] = gym.spaces.Box(
-np.inf, np.inf, shape=(1,), dtype=np.float32
)
return gym.spaces.Dict(spaces)
def step(self, action):
obs, reward, done, info = self._env.step(action)
obs["reward"] = reward
if "reward" not in obs:
obs["reward"] = reward
return obs, reward, done, info
def reset(self):
obs = self._env.reset()
obs["reward"] = 0.0
if "reward" not in obs:
obs["reward"] = 0.0
return obs