From c44a58ffb332ec3577825ff9a82b37704cdd0357 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20Schr=C3=B6der?=
 <fschroeder@techfak.uni-bielefeld.de>
Date: Thu, 18 Jan 2024 15:47:59 +0100
Subject: [PATCH] fix dirty plate bug and realistic times

---
 .../game_content/environment_config.yaml      |  8 +-
 .../game_content/item_info.yaml               | 14 +--
 .../game_content/item_info_debug.yaml         | 96 +++++++++++++++++++
 overcooked_simulator/game_items.py            |  4 +-
 .../gui_2d_vis/overcooked_gui.py              |  4 +-
 .../gui_2d_vis/visualization.yaml             |  2 +-
 6 files changed, 113 insertions(+), 15 deletions(-)
 create mode 100644 overcooked_simulator/game_content/item_info_debug.yaml

diff --git a/overcooked_simulator/game_content/environment_config.yaml b/overcooked_simulator/game_content/environment_config.yaml
index 400f16d1..594decfa 100644
--- a/overcooked_simulator/game_content/environment_config.yaml
+++ b/overcooked_simulator/game_content/environment_config.yaml
@@ -11,16 +11,16 @@ orders:
     duration_sample:
       func: uniform
       kwargs:
-        a: 3
-        b: 5
+        a: 40
+        b: 60
     max_orders: 6
     num_start_meals: 3
     sample_on_dur: true
     sample_on_dur_func:
       func: uniform
       kwargs:
-        a: 1
-        b: 2
+        a: 10
+        b: 20
     sample_on_serving: false
     score_calc_gen_kwargs:
       other: 0
diff --git a/overcooked_simulator/game_content/item_info.yaml b/overcooked_simulator/game_content/item_info.yaml
index f87d6617..777e5f28 100644
--- a/overcooked_simulator/game_content/item_info.yaml
+++ b/overcooked_simulator/game_content/item_info.yaml
@@ -44,30 +44,30 @@ Bun:
 ChoppedTomato:
   type: Ingredient
   needs: [ Tomato ]
-  seconds: 0.1
+  seconds: 4.0
   equipment: CuttingBoard
 
 ChoppedLettuce:
   type: Ingredient
   needs: [ Lettuce ]
-  seconds: 0.1
+  seconds: 3.0
   equipment: CuttingBoard
 
 ChoppedOnion:
   type: Ingredient
   needs: [ Onion ]
-  seconds: 0.1
+  seconds: 5.0
   equipment: CuttingBoard
 
 ChoppedMeat:
   type: Ingredient
   needs: [ Meat ]
-  seconds: 0.1
+  seconds: 4.0
   equipment: CuttingBoard
 
 CookedPatty:
   type: Ingredient
-  seconds: 2.0
+  seconds: 5.0
   needs: [ ChoppedMeat ]
   equipment: Pan
 
@@ -86,11 +86,11 @@ Salad:
 TomatoSoup:
   type: Meal
   needs: [ ChoppedTomato, ChoppedTomato, ChoppedTomato ]
-  seconds: 3.0
+  seconds: 6.0
   equipment: Pot
 
 OnionSoup:
   type: Meal
   needs: [ ChoppedOnion, ChoppedOnion, ChoppedOnion ]
-  seconds: 3.0
+  seconds: 6.0
   equipment: Pot
diff --git a/overcooked_simulator/game_content/item_info_debug.yaml b/overcooked_simulator/game_content/item_info_debug.yaml
new file mode 100644
index 00000000..32c86966
--- /dev/null
+++ b/overcooked_simulator/game_content/item_info_debug.yaml
@@ -0,0 +1,96 @@
+CuttingBoard:
+  type: Equipment
+
+Sink:
+  type: Equipment
+
+Stove:
+  type: Equipment
+
+Pot:
+  type: Equipment
+  equipment: Stove
+
+Pan:
+  type: Equipment
+  equipment: Stove
+
+DirtyPlate:
+  type: Equipment
+
+Plate:
+  type: Equipment
+  needs: [ DirtyPlate ]
+  seconds: 1.0
+  equipment: Sink
+
+# --------------------------------------------------------------------------------
+
+Tomato:
+  type: Ingredient
+
+Lettuce:
+  type: Ingredient
+
+Onion:
+  type: Ingredient
+
+Meat:
+  type: Ingredient
+
+Bun:
+  type: Ingredient
+
+ChoppedTomato:
+  type: Ingredient
+  needs: [ Tomato ]
+  seconds: 0.1
+  equipment: CuttingBoard
+
+ChoppedLettuce:
+  type: Ingredient
+  needs: [ Lettuce ]
+  seconds: 0.1
+  equipment: CuttingBoard
+
+ChoppedOnion:
+  type: Ingredient
+  needs: [ Onion ]
+  seconds: 0.1
+  equipment: CuttingBoard
+
+ChoppedMeat:
+  type: Ingredient
+  needs: [ Meat ]
+  seconds: 0.1
+  equipment: CuttingBoard
+
+CookedPatty:
+  type: Ingredient
+  seconds: 2.0
+  needs: [ ChoppedMeat ]
+  equipment: Pan
+
+# --------------------------------------------------------------------------------
+
+Burger:
+  type: Meal
+  needs: [ Bun, ChoppedLettuce, ChoppedTomato, CookedPatty ]
+  equipment: ~
+
+Salad:
+  type: Meal
+  needs: [ ChoppedLettuce, ChoppedTomato ]
+  equipment: ~
+
+TomatoSoup:
+  type: Meal
+  needs: [ ChoppedTomato, ChoppedTomato, ChoppedTomato ]
+  seconds: 3.0
+  equipment: Pot
+
+OnionSoup:
+  type: Meal
+  needs: [ ChoppedOnion, ChoppedOnion, ChoppedOnion ]
+  seconds: 3.0
+  equipment: Pot
diff --git a/overcooked_simulator/game_items.py b/overcooked_simulator/game_items.py
index f470d07d..4592e68b 100644
--- a/overcooked_simulator/game_items.py
+++ b/overcooked_simulator/game_items.py
@@ -129,6 +129,7 @@ class CookingEquipment(Item):
         ingredients = collections.Counter(
             item.name for item in self.content_list + other
         )
+        print(ingredients)
         return any(
             ingredients <= recipe["recipe"] for recipe in self.transitions.values()
         )
@@ -237,5 +238,6 @@ class Plate(CookingEquipment):
             ):
                 return other.content_list[0].name in self.meals
             return False
-        else:
+        elif self.clean:
             return True
+        return False
diff --git a/overcooked_simulator/gui_2d_vis/overcooked_gui.py b/overcooked_simulator/gui_2d_vis/overcooked_gui.py
index 6240f4d9..e7957d95 100644
--- a/overcooked_simulator/gui_2d_vis/overcooked_gui.py
+++ b/overcooked_simulator/gui_2d_vis/overcooked_gui.py
@@ -524,8 +524,8 @@ class PyGameGUI:
         """
 
         pos = counter.pos * self.grid_size
-
-        self.draw_thing(pos, self.visualization_config["Counter"]["parts"])
+        if counter.__class__.__name__ != "Trash":
+            self.draw_thing(pos, self.visualization_config["Counter"]["parts"])
         if str(counter) in self.visualization_config:
             self.draw_thing(pos, self.visualization_config[str(counter)]["parts"])
         else:
diff --git a/overcooked_simulator/gui_2d_vis/visualization.yaml b/overcooked_simulator/gui_2d_vis/visualization.yaml
index 35ce1d92..532d9e2a 100644
--- a/overcooked_simulator/gui_2d_vis/visualization.yaml
+++ b/overcooked_simulator/gui_2d_vis/visualization.yaml
@@ -2,7 +2,7 @@
 
 GameWindow:
   WhatIsFixed: grid  # grid or window_width or window_height
-  size: 50
+  size: 80
   screen_margin: 100
   min_width: 700
   min_height: 600
-- 
GitLab