yxc20098 commited on
Commit
1b62e34
·
1 Parent(s): a1d3e46

adapter: use engine map_info for true map dims (S9), synthesis fallback

Browse files
Files changed (1) hide show
  1. openra_bench/rust_adapter.py +8 -5
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
- """Derive a working (width, height) from observed extents.
202
-
203
- Phase 0: the Rust env exposes no map_info; bound from observed
204
- cells. Phase 3 will plumb true map dims through the adapter.
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: