From f0e5a2e6c3e654c9889e42ec933a2c1514e81524 Mon Sep 17 00:00:00 2001 From: Mark Towers Date: Sun, 9 Apr 2023 11:40:12 +0100 Subject: [PATCH] Fixes the documentation through ignoring tabular/CliffWalking (#443) --- docs/scripts/gen_mds.py | 1 + gymnasium/envs/tabular/cliffwalking.py | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/scripts/gen_mds.py b/docs/scripts/gen_mds.py index f1e0b1cb3..acb44ba41 100644 --- a/docs/scripts/gen_mds.py +++ b/docs/scripts/gen_mds.py @@ -17,6 +17,7 @@ exclude_env_names = [ "phys2d/CartPole", "phys2d/Pendulum", "tabular/Blackjack", + "tabular/CliffWalking", ] for env_spec in gym.registry.values(): if get_env_id(env_spec.namespace, env_spec.name, None) not in exclude_env_names: diff --git a/gymnasium/envs/tabular/cliffwalking.py b/gymnasium/envs/tabular/cliffwalking.py index ffde1b5e4..079e5a962 100644 --- a/gymnasium/envs/tabular/cliffwalking.py +++ b/gymnasium/envs/tabular/cliffwalking.py @@ -20,7 +20,6 @@ from gymnasium.wrappers import HumanRendering if TYPE_CHECKING: - import numpy import pygame @@ -31,7 +30,7 @@ class RenderStateType(NamedTuple): shape: tuple[int, int] nS: int cell_size: tuple[int, int] - cliff: numpy.ndarray + cliff: np.ndarray elf_images: tuple[pygame.Surface, pygame.Surface, pygame.Surface, pygame.Surface] start_img: pygame.Surface goal_img: pygame.Surface @@ -176,12 +175,11 @@ class CliffWalkingFunctional( return new_state - def initial(self, rng: PRNGKey): + def initial(self, rng: PRNGKey) -> EnvState: """Cliffwalking initial observation function.""" player_position = jnp.array([3, 0]) state = EnvState(player_position=player_position, last_action=-1, fallen=False) - return state def observation(self, state: EnvState) -> int: