File size: 1,300 Bytes
284f0a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
39
40
# 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 Map Environment.

Grid navigation with fog of war. Agent must navigate to goal efficiently.
"""

from typing import Dict, List

from openenv.core.env_server.types import Action, Observation
from pydantic import Field


class MapAction(Action):
    """Action for the Map environment - move in a direction."""

    direction: str = Field(..., description="Direction to move: 'up', 'down', 'left', 'right'")


class MapObservation(Observation):
    """Observation from the Map environment."""

    visible_cells: List[Dict] = Field(
        default_factory=list,
        description="List of visible cells, each with {x, y, type}"
    )
    position: Dict = Field(
        default_factory=dict,
        description="Agent's current position {x, y}"
    )
    moves: int = Field(default=0, description="Number of moves taken")
    max_moves: int = Field(default=50, description="Maximum allowed moves")
    grid_size: int = Field(default=8, description="Size of the grid (NxN)")
    reached_goal: bool = Field(default=False, description="Whether agent reached the goal")