Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
server/wildfire_environment.py
CHANGED
|
@@ -87,22 +87,9 @@ class WildfireEnvironment(Environment):
|
|
| 87 |
# burn lifetime in ticks (balanced model)
|
| 88 |
self.burn_lifetime = 3
|
| 89 |
|
| 90 |
-
#
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
step_count=0,
|
| 94 |
-
total_burned=0,
|
| 95 |
-
total_extinguished=0,
|
| 96 |
-
last_action="reset",
|
| 97 |
-
width=0,
|
| 98 |
-
height=0,
|
| 99 |
-
wind_dir="CALM",
|
| 100 |
-
humidity=0.25,
|
| 101 |
-
remaining_water=self.init_water,
|
| 102 |
-
remaining_breaks=self.init_breaks,
|
| 103 |
-
grid=[],
|
| 104 |
-
burn_timers=[],
|
| 105 |
-
)
|
| 106 |
|
| 107 |
# --- Core API ---
|
| 108 |
|
|
@@ -424,5 +411,7 @@ class WildfireEnvironment(Environment):
|
|
| 424 |
@property
|
| 425 |
def state(self) -> WildfireState:
|
| 426 |
"""Return the current environment state."""
|
|
|
|
|
|
|
| 427 |
return self._state
|
| 428 |
|
|
|
|
| 87 |
# burn lifetime in ticks (balanced model)
|
| 88 |
self.burn_lifetime = 3
|
| 89 |
|
| 90 |
+
# State will be initialized in reset() - using None as placeholder to avoid Pydantic/dataclass conflicts
|
| 91 |
+
# The state property should not be accessed before reset() is called
|
| 92 |
+
self._state: WildfireState | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
# --- Core API ---
|
| 95 |
|
|
|
|
| 411 |
@property
|
| 412 |
def state(self) -> WildfireState:
|
| 413 |
"""Return the current environment state."""
|
| 414 |
+
if self._state is None:
|
| 415 |
+
raise RuntimeError("State not initialized. Call reset() first.")
|
| 416 |
return self._state
|
| 417 |
|