From 51782767ac6398772b8a246129d41242a6a5b051 Mon Sep 17 00:00:00 2001 From: fheinrich <fheinrich@techfak.uni-bielefeld.de> Date: Thu, 7 Mar 2024 13:27:17 +0100 Subject: [PATCH] Better recipe and meal names displayed in gui --- cooperative_cuisine/pygame_2d_vis/gui.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cooperative_cuisine/pygame_2d_vis/gui.py b/cooperative_cuisine/pygame_2d_vis/gui.py index c58c36a2..02ee0136 100644 --- a/cooperative_cuisine/pygame_2d_vis/gui.py +++ b/cooperative_cuisine/pygame_2d_vis/gui.py @@ -3,6 +3,7 @@ import json import logging import os import random +import re import signal import subprocess import sys @@ -1133,7 +1134,9 @@ class PyGameGUI: anchors=anchors, ) - text = f"Player {player} served meal {meal}." + meal = re.sub(r"(?<!^)(?=[A-Z])", " ", meal) + meal = meal.replace("(", "").replace(")", "") + text = f"Player {player} served a {meal}." meal_label = pygame_gui.elements.UILabel( text=text, relative_rect=pygame.Rect( @@ -1345,6 +1348,7 @@ class PyGameGUI: for idx, rg in enumerate(self.level_info["recipe_graphs"]): meal = rg["meal"] + meal = re.sub(r"(?<!^)(?=[A-Z])", " ", meal) positions = np.array(list(rg["layout"].values())) unique_vals = np.unique(positions[:, 1]) -- GitLab