maze_openenv / models.py
tripathysagar's picture
Upload folder using huggingface_hub
b2936e2 verified
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""
Data models for the Maze OpenEnv Environment.
A grid maze environment where an agent navigates from start to goal.
"""
from typing import List
from pydantic import Field
from openenv.core.env_server.types import Action, Observation, State
class MazeAction(Action):
"""Action for the Maze environment - movement direction."""
direction: str = Field(..., description="Movement direction: up, down, left, right")
class MazeObservation(Observation):
"""Observation from the Maze environment."""
position: List[int] = Field(default_factory=list, description="Current [row, col] position")
grid_view: str = Field(default="", description="ASCII representation of the maze")
class MazeState(State):
"""Internal state of the Maze environment."""
maze: List[List[int]] = Field(default_factory=list, description="The maze grid (1=walkable, 0=wall)")
agent_pos: List[int] = Field(default_factory=list, description="Agent's current position")
goal_pos: List[int] = Field(default_factory=list, description="Goal position")