From 50633ed4f75025192d21f9ab8a7a2677aa65a4cd Mon Sep 17 00:00:00 2001 From: Franziska Gerold Date: Fri, 19 Dec 2025 02:40:03 +1100 Subject: [PATCH] =?UTF-8?q?Nachricht=20nach=20richtiger=20Aktion=20eingef?= =?UTF-8?q?=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bop_it_sensors.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Bop_it_sensors.py b/Bop_it_sensors.py index c1a6ee4..d8b6283 100644 --- a/Bop_it_sensors.py +++ b/Bop_it_sensors.py @@ -11,9 +11,9 @@ tilt = Button(23) def command_tilt(): print("Tilt me!") result = tilt.wait_for_press(timeout=10) - print(f"Result: {result}") if result: time.sleep(0.3) # soll verhindern, dass die vorherige Runde die jetzige beeinflusst + print(success_message()) return 1 else: return -1 @@ -23,8 +23,8 @@ def command_tilt(): def command_blind(): print('Blind me!') result = laser.wait_for_press(timeout=10) - print(f"Result: {result}") if result: + print(success_message()) return 1 else: return -1 @@ -32,9 +32,9 @@ def command_blind(): def command_scream(): print('Make noise at me!') result = sound.wait_for_press(timeout=10) - print(f"Result: {result}") if result: time.sleep(0.3) #soll verhindern, dass dasGeräuschsignal aus der vorherigen Runde gezählt wird + print(success_message()) return 1 else: return -1 @@ -43,6 +43,7 @@ def command_spin_clockwise(): print("Spin me... clockwise!") result = rotate.wait_for_rotate_clockwise(timeout=10) if result: + print(success_message()) return 1 else: return -1 @@ -51,10 +52,16 @@ def command_spin_counter_clockwise(): print("Spin me... counter clockwise!") result = rotate.wait_for_rotate_counter_clockwise(timeout=10) if result: + print(success_message()) return 1 else: return -1 +def success_message(): + list_of_messages = ["Great job!", "Correct!", "Nice!", "You know it!", "That's what I'm talking about", "Perfect!"] + message = random.choice(list_of_messages) + return message + def main(): score = 0 result = 0