Skip to content
Snippets Groups Projects
Commit 8f57b64a authored by Fabian Heinrich's avatar Fabian Heinrich
Browse files

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	CHANGELOG.md
parents 685927e2 54f94688
No related branches found
No related tags found
No related merge requests found
Pipeline #50675 passed
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
### Added ### Added
- Recipe graphs contain the names of the interactive counters and equipment
- Random agent also gets the recipe graph information.
Hook SCORE_CHANGED when the score is increased. Hook SCORE_CHANGED when the score is increased.
### Changed ### Changed
...@@ -25,6 +28,8 @@ Hook SCORE_CHANGED when the score is increased. ...@@ -25,6 +28,8 @@ Hook SCORE_CHANGED when the score is increased.
### Fixed ### Fixed
- Random Order generation does not depend on other sampling of random numbers.
### Security ### Security
## [1.1.1] (2024-04-03) ## [1.1.1] (2024-04-03)
......
...@@ -50,10 +50,12 @@ async def agent(): ...@@ -50,10 +50,12 @@ async def agent():
parser.add_argument("--player_id", type=str) parser.add_argument("--player_id", type=str)
parser.add_argument("--player_hash", type=str) parser.add_argument("--player_hash", type=str)
parser.add_argument("--step_time", type=float, default=0.1) parser.add_argument("--step_time", type=float, default=0.1)
parser.add_argument("--recipe_graph", type=str, default="")
args = parser.parse_args() args = parser.parse_args()
async with (connect(args.uri) as websocket): async with (connect(args.uri) as websocket):
recipe_graph = json.loads(args.recipe_graph)
await websocket.send( await websocket.send(
json.dumps({"type": "ready", "player_hash": args.player_hash}) json.dumps({"type": "ready", "player_hash": args.player_hash})
) )
......
...@@ -217,7 +217,7 @@ class Environment: ...@@ -217,7 +217,7 @@ class Environment:
self.order_manager: OrderManager = OrderManager( self.order_manager: OrderManager = OrderManager(
order_config=self.environment_config["orders"], order_config=self.environment_config["orders"],
hook=self.hook, hook=self.hook,
random=self.random, random=Random(seed),
) )
"""The manager for the orders and score update.""" """The manager for the orders and score update."""
......
...@@ -1756,6 +1756,7 @@ class PyGameGUI: ...@@ -1756,6 +1756,7 @@ class PyGameGUI:
f'--uri {player_info["websocket_url"]}', f'--uri {player_info["websocket_url"]}',
f"--player_hash {player_hash}", f"--player_hash {player_hash}",
f"--player_id {player_id}", f"--player_id {player_id}",
f"--recipe_graph '{json.dumps(self.level_info['recipe_graphs'])}'",
] ]
), ),
shell=True, shell=True,
......
...@@ -34,6 +34,9 @@ class MealGraphDict(TypedDict): ...@@ -34,6 +34,9 @@ class MealGraphDict(TypedDict):
"""A dictionary mapping cooking step names to their layout coordinates.""" """A dictionary mapping cooking step names to their layout coordinates."""
score: float score: float
"""The max possible score of the meal.""" """The max possible score of the meal."""
info: dict[str, list[str]]
"""The names of the `interactive_counter` and `equipment` (not the ids of the individual). Is not reduced to the
meal."""
class Validation: class Validation:
...@@ -70,6 +73,21 @@ class Validation: ...@@ -70,6 +73,21 @@ class Validation:
self.recipe_graph_dicts: dict | None = None self.recipe_graph_dicts: dict | None = None
"""A dictionary containing recipe graphs for each meal. For visualisation of the recipes.""" """A dictionary containing recipe graphs for each meal. For visualisation of the recipes."""
self.interactive_counter = [
c
for c in self.item_info
if self.item_info[c].type == ItemType.Equipment
and not self.item_info[c].equipment
]
"""The list of names of stationary mentioned equipments like stove, cutting board but not pot etc."""
self.equipments = [
eq
for eq in self.item_info
if self.item_info[eq].type == ItemType.Equipment
and self.item_info[eq].equipment
]
"""The list of names of the equipments in the environment."""
@staticmethod @staticmethod
def infer_recipe_graph(item_info) -> DiGraph: def infer_recipe_graph(item_info) -> DiGraph:
"""Generate a graph from ingredients and meals and their dependencies. """Generate a graph from ingredients and meals and their dependencies.
...@@ -210,6 +228,10 @@ class Validation: ...@@ -210,6 +228,10 @@ class Validation:
"edges": list(graph.edges), "edges": list(graph.edges),
"layout": layout, "layout": layout,
"score": score, "score": score,
"info": {
"interactive_counter": self.interactive_counter,
"equipment": self.equipments,
},
} }
with open(generated_graph_layouts_path, "w") as f: with open(generated_graph_layouts_path, "w") as f:
self.recipe_graph_dicts[graph_hash] = graph_dict self.recipe_graph_dicts[graph_hash] = graph_dict
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment