Spaces:
Running
Running
adapter: use engine map_info for true map dims (S9), synthesis fallback
Browse files
openra_bench/rust_adapter.py
CHANGED
|
@@ -198,11 +198,14 @@ class RustObsAdapter:
|
|
| 198 |
|
| 199 |
# -- render schema ----------------------------------------------------
|
| 200 |
def grid_dims(self, margin: int = 4) -> tuple[int, int]:
|
| 201 |
-
"""
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
""
|
|
|
|
|
|
|
|
|
|
| 206 |
xs, ys = [0], [0]
|
| 207 |
for src in (self._explored, _cells(self._raw.get("explored_cells"))):
|
| 208 |
for x, y in src:
|
|
|
|
| 198 |
|
| 199 |
# -- render schema ----------------------------------------------------
|
| 200 |
def grid_dims(self, margin: int = 4) -> tuple[int, int]:
|
| 201 |
+
"""True map (width, height) from the engine's map_info when
|
| 202 |
+
available (S9), else bound from observed extents (legacy
|
| 203 |
+
fallback for envs that don't emit map_info)."""
|
| 204 |
+
mi = self._raw.get("map_info") or {}
|
| 205 |
+
if isinstance(mi, dict) and int(mi.get("width", 0)) > 0 and int(
|
| 206 |
+
mi.get("height", 0)
|
| 207 |
+
) > 0:
|
| 208 |
+
return int(mi["width"]), int(mi["height"])
|
| 209 |
xs, ys = [0], [0]
|
| 210 |
for src in (self._explored, _cells(self._raw.get("explored_cells"))):
|
| 211 |
for x, y in src:
|