from __future__ import annotations
import os
import gymnasium
# Display bonus WFC presets
from minigrid.envs.wfc import WFCEnv
from minigrid.envs.wfc.config import (
WFC_PRESETS_INCONSISTENT,
WFC_PRESETS_SLOW,
register_wfc_presets,
)
from utils import env_name_format
register_wfc_presets(WFC_PRESETS_INCONSISTENT, gymnasium.register)
register_wfc_presets(WFC_PRESETS_SLOW, gymnasium.register)
# Read name from the actual class so it is updated if the class name changes
WFCENV_NAME = WFCEnv.__name__
def title_from_id(env_id):
words = []
for chunk in env_id.split("_"):
words.extend(env_name_format(chunk).split(" "))
return " ".join(w.title() for w in words)
def create_grid_cell(type_id, env_id, base_path):
# All WFCEnv environments should link to WFCEnv page
href = f"{base_path}{env_id if type_id != 'wfc' else WFCENV_NAME}"
return f"""