File size: 1,282 Bytes
b2936e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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")