From 667b650cafb1277878fa6b138c964cb091ff4e9a Mon Sep 17 00:00:00 2001
From: fheinrich <fheinrich@techfak.uni-bielefeld.de>
Date: Tue, 26 Mar 2024 15:10:35 +0100
Subject: [PATCH] Fixed graph generation when multiple meals are combined.
 Added Burger with fries

---
 cooperative_cuisine/configs/item_info.yaml    |  5 +++
 .../pygame_2d_vis/visualization.yaml          | 42 ++++++++++++++-----
 cooperative_cuisine/validation.py             | 10 +++--
 3 files changed, 43 insertions(+), 14 deletions(-)

diff --git a/cooperative_cuisine/configs/item_info.yaml b/cooperative_cuisine/configs/item_info.yaml
index 96ddf78c..f8a14b7f 100644
--- a/cooperative_cuisine/configs/item_info.yaml
+++ b/cooperative_cuisine/configs/item_info.yaml
@@ -172,6 +172,11 @@ FishAndChips:
   needs: [ FriedFish, Chips ]
   equipment: ~
 
+BurgerWithChips:
+  type: Meal
+  needs: [ Burger, Chips ]
+  equipment: ~
+
 Pizza:
   type: Meal
   needs: [ PizzaBase, ChoppedTomato, GratedCheese, ChoppedSausage ]
diff --git a/cooperative_cuisine/pygame_2d_vis/visualization.yaml b/cooperative_cuisine/pygame_2d_vis/visualization.yaml
index 6cccb65b..9b2dcffe 100644
--- a/cooperative_cuisine/pygame_2d_vis/visualization.yaml
+++ b/cooperative_cuisine/pygame_2d_vis/visualization.yaml
@@ -5,6 +5,7 @@ Gui:
   use_player_cook_sprites: True
   show_interaction_range: False
   show_counter_centers: False
+  press_button_to_continue: False
 
 GameWindow:
   screen_margin_proportion: 0.15
@@ -35,6 +36,16 @@ Counter:
       path: images/counter5.png
       size: 1
 
+EdgeCounter:
+  parts:
+    #    - type: rect
+    #      height: 1
+    #      width: 1
+    #      color: whitesmoke
+    - type: image
+      path: images/wall.png
+      size: 1
+
 CuttingBoard:
   parts:
     - type: image
@@ -44,11 +55,10 @@ CuttingBoard:
 
 
 PlateDispenser:
-  parts: [ ]
-#    - type: rect
-#      height: 0.95
-#      width: 0.95
-#      color: cadetblue1
+  parts:
+    - type: image
+      path: images/plate_dispenser.png
+      size: 1
 
 Trashcan:
   parts:
@@ -113,11 +123,11 @@ ServingWindow:
       size: 0.8
       center_offset: [ 0, -0.02 ]
       rotate_image: False
-    - type: image
-      path: images/bell_gold.png
-      size: 0.5
-      center_offset: [ -0.2, -0.05 ]
-      rotate_image: False
+#    - type: image
+#      path: images/bell_gold.png
+#      size: 0.5
+#      center_offset: [ -0.2, -0.05 ]
+#      rotate_image: False
 
 Stove:
   parts:
@@ -376,6 +386,18 @@ FishAndChips:
       size: 0.8
       center_offset: [ +0.2, 0 ]
 
+BurgerWithChips:
+  parts:
+    - type: image
+      path: images/fries2.png
+      size: 0.8
+      center_offset: [ -0.1, 0 ]
+    - type: image
+      path: images/burger.png
+      size: 0.8
+      center_offset: [ +0.2, 0 ]
+
+
 Dough:
   parts:
     - type: image
diff --git a/cooperative_cuisine/validation.py b/cooperative_cuisine/validation.py
index e6b615cb..cea54975 100644
--- a/cooperative_cuisine/validation.py
+++ b/cooperative_cuisine/validation.py
@@ -2,6 +2,7 @@
 import hashlib
 import json
 import os
+import uuid
 import warnings
 from typing import TypedDict, Tuple, Iterator, Set
 
@@ -144,18 +145,19 @@ class Validation:
                         graph.add_edge(need, current)
 
                 elif len(current_info.needs) > 1:
-                    for idx, item_name in enumerate(current_info.needs):
-                        add_queue.append(f"{item_name}_{idx}")
+                    for item_name in current_info.needs:
+                        unique_id = uuid.uuid4().hex
+                        add_queue.append(f"{item_name}_{unique_id}")
 
                         if current_info.equipment and current_info.equipment.equipment:
                             equip_id = f"{current_info.equipment.name}_{current_index}"
                             equip_equip_id = f"{current_info.equipment.equipment.name}_{current_index}"
                             graph.add_edge(equip_equip_id, current)
                             graph.add_edge(equip_id, equip_equip_id)
-                            graph.add_edge(f"{item_name}_{idx}", equip_id)
+                            graph.add_edge(f"{item_name}_{unique_id}", equip_id)
                         else:
                             graph.add_edge(
-                                f"{item_name}_{idx}",
+                                f"{item_name}_{unique_id}",
                                 current,
                             )
 
-- 
GitLab