#2085: Get enum value data
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# import os
|
import json
|
||||||
from typing import Any, Dict, Final, Optional, SupportsFloat, Tuple
|
from typing import Any, Dict, Final, Optional, SupportsFloat, Tuple
|
||||||
|
|
||||||
import gymnasium
|
import gymnasium
|
||||||
@@ -34,14 +34,15 @@ class PrimaiteGymEnv(gymnasium.Env):
|
|||||||
state = self.game.get_sim_state()
|
state = self.game.get_sim_state()
|
||||||
|
|
||||||
# Create state suitable for dumping to file.
|
# Create state suitable for dumping to file.
|
||||||
dump_state = {self.game.episode_counter: {self.game.step_counter: state}}
|
# dump_state = {self.game.episode_counter: {self.game.step_counter: state}}
|
||||||
|
|
||||||
# Dump to file
|
# Dump to file
|
||||||
# if os.path.isfile(PRIMAITE_PATHS.episode_steps_log_file_path):
|
# if os.path.isfile(PRIMAITE_PATHS.episode_steps_log_file_path):
|
||||||
with open(PRIMAITE_PATHS.episode_log_file_path, "a", encoding="utf-8") as f:
|
with open(PRIMAITE_PATHS.episode_log_file_path, "a", encoding="utf-8") as f:
|
||||||
f.write(str(dump_state))
|
# f.write(str(dump_state))
|
||||||
f.write("\n=================\n")
|
# f.write("\n=================\n")
|
||||||
f.flush()
|
# f.flush()
|
||||||
|
json.dump(state, f)
|
||||||
|
|
||||||
self.game.update_agents(state)
|
self.game.update_agents(state)
|
||||||
|
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ class Service(IOSoftware):
|
|||||||
"""
|
"""
|
||||||
state = super().describe_state()
|
state = super().describe_state()
|
||||||
state["operating_state"] = self.operating_state.value
|
state["operating_state"] = self.operating_state.value
|
||||||
state["health_state_actual"] = self.health_state_actual
|
state["health_state_actual"] = self.health_state_actual.value
|
||||||
state["health_state_visible"] = self.health_state_visible
|
state["health_state_visible"] = self.health_state_visible.value
|
||||||
return state
|
return state
|
||||||
|
|
||||||
def stop(self) -> None:
|
def stop(self) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user