From fa5595eaa35e9d3adafaa536b1d7c7287bf54acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Schr=C3=B6der?= <fschroeder@techfak.uni-bielefeld.de> Date: Wed, 31 Jan 2024 20:10:53 +0100 Subject: [PATCH] Refactor code for better readability and clarity The changes include improving the wording in readme files, from 'Python 3.10 or higher' to 'Python 3 --- README.md | 2 +- overcooked_simulator/__init__.py | 82 +++++++++++++++++++++++++++++++- overcooked_simulator/counters.py | 34 ++++++------- 3 files changed, 99 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 1d25c126..3a51e9e6 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The real-time overcooked simulation for a cognitive cooperative system. You have two options to install the environment. Either clone it and install it locally or install it in your site-packages. -You need a Python 3.10 or higher environment. Either conda or PyEnv. +You need a Python 3.10 or greater environment. Either conda or PyEnv. ### Local Editable Installation diff --git a/overcooked_simulator/__init__.py b/overcooked_simulator/__init__.py index fb5fb7c0..14f91139 100644 --- a/overcooked_simulator/__init__.py +++ b/overcooked_simulator/__init__.py @@ -21,7 +21,7 @@ like a "real" cooperative / human partner. # Installation -You need a Python **3.10** or higher environment. +You need a Python **3.10** or greater environment. ```bash pip install overcooked-environment@git+https://gitlab.ub.uni-bielefeld.de/scs/cocosy/overcooked-simulator@main ``` @@ -217,17 +217,97 @@ The environment configuration is currently done with 3 config files + GUI config The item config defines which ingredients, cooking equipment and meals can exist and how meals and processed ingredients can be cooked/created. +For example + +```yaml +CuttingBoard: + type: Equipment + +Stove: + type: Equipment + +Pot: + type: Equipment + equipment: Stove + +Tomato: + type: Ingredient + +ChoppedTomato: + type: Ingredient + needs: [ Tomato ] + seconds: 4.0 + equipment: CuttingBoard + +TomatoSoup: + type: Meal + needs: [ ChoppedTomato, ChoppedTomato, ChoppedTomato ] + seconds: 6.0 + equipment: Pot +``` + ## Layout Config You can define the layout of the kitchen via a layout file. The position of counters are based on a grid system, even when the players do not move grid steps but continuous steps. Each character defines a different type of counter. Which character is mapped to which counter is defined in the Environment config. +For example + +``` +#QU#FO#TNLB# +#__________M +#__________K +W__________I +#__A_____A_D +C__________E +C__________G +#__________# +#P#S+#X##S+# +``` + ## Environment Config The environment config defines how a level/environment is defined. Here, the available plates, meals, order and player configuration is done. +For example + +```yaml +plates: + clean_plates: 1 + dirty_plates: 2 + plate_delay: [ 5, 10 ] + # range of seconds until the dirty plate arrives. + +game: + time_limit_seconds: 300 + +meals: + all: true + +layout_chars: + _: Free + hash: Counter + A: Agent + P: PlateDispenser + C: CuttingBoard + X: Trashcan + W: ServingWindow + S: Sink + +: SinkAddon + U: Pot # with Stove + T: Tomato + +orders: + ... + +player_config: + radius: 0.4 + player_speed_units_per_seconds: 8 + interaction_range: 1.6 +``` + ## PyGame Visualization Config Here the visualisation for all objects is defined. Reference the images or define a list of base shapes that represent diff --git a/overcooked_simulator/counters.py b/overcooked_simulator/counters.py index fdfa9b02..7e07048f 100644 --- a/overcooked_simulator/counters.py +++ b/overcooked_simulator/counters.py @@ -7,17 +7,17 @@ method, e.g., the `CuttingBoard.progress`. The environment class detects which c `progress` method defined and on instances of these classes the progress will be delegated. Inside the item_info.yaml, equipment needs to be defined. It includes counters that are part of the -interaction/requirements for the interaction: -```yaml -CuttingBoard: - type: Equipment +interaction/requirements for the interaction. -Sink: - type: Equipment + CuttingBoard: + type: Equipment + + Sink: + type: Equipment + + Stove: + type: Equipment -Stove: - type: Equipment -``` The defined counter classes are: - `Counter` @@ -175,14 +175,14 @@ class Counter: class CuttingBoard(Counter): - """Cutting ingredients on. The requirement in a new object could look like: - ```yaml - ChoppedTomato: - type: Ingredient - needs: [ Tomato ] - seconds: 4.0 - equipment: CuttingBoard - ``` + """Cutting ingredients on. The requirement in a new object could look like. + + ChoppedTomato: + type: Ingredient + needs: [ Tomato ] + seconds: 4.0 + equipment: CuttingBoard + The character `C` in the `layout` file represents the CuttingBoard. """ -- GitLab