From 67cd8cfaa64eae3d31d175919cbbebfa839f9607 Mon Sep 17 00:00:00 2001 From: Jonas_Jones <91549607+J-onasJones@users.noreply.github.com> Date: Fri, 23 Dec 2022 03:28:48 +0100 Subject: [PATCH] fixed uwu --- main.py | 2 +- screen_handler.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 32c4eed..846dd58 100644 --- a/main.py +++ b/main.py @@ -76,7 +76,7 @@ def main(first_time:bool=True, previous_config = None): for i in range(0, int(previous_config[1])): players.append(PLAYER(screen_handler.console_input( f'Name for Player {i + 1}: In der kürze liegt die Würze \ - (In short lies the spice :) )', '', screen=screen), [])) +(In short lies the spice :) )', '', screen=screen), [])) for i in range(0, int(previous_config[2])): players.append(BOT(f'Bot {i + 1}', i + 1, [])) diff --git a/screen_handler.py b/screen_handler.py index 30ea97c..0bca00c 100644 --- a/screen_handler.py +++ b/screen_handler.py @@ -108,7 +108,7 @@ def config_sequence(screen:Matrix): config[question_no + 1] = input previous_question = i question_no += 1 - question_possible_asnwers[1] = f"{'0' if config[1] == '5' else '1'} -\ + question_possible_asnwers[1] = f"{'0' if config[1] == '5' else '2' if config[1] == '0' else '1'} -\ {5 - int(config[1])}" return config @@ -303,8 +303,14 @@ def player_interface(screen:Matrix, player:PLAYER, round_no:int, stich:int, {player.get_points()}") draw_player_cards(screen, player.get_cards()) screen.print() - chosen_card = console_input("Choose a card by its number", "[1 - " +\ - str(len(player.get_cards())) + "]", screen, fullscreen=True) + wrong_input = True + while wrong_input: + chosen_card = console_input("Choose a card by its number", "[1 - " +\ + str(len(player.get_cards())) + "]", screen, fullscreen=True) + if chosen_card.isdigit(): + if int(chosen_card) > 0 and int(chosen_card) <=\ + len(player.get_cards()): + wrong_input = False return player.pop_card(int(chosen_card) - 1) def bot_interface(screen:Matrix, bot:BOT, round_no:int, stich:int):