This commit is contained in:
ImFlizzyy 2022-12-23 03:37:14 +01:00
commit ea538f6067
2 changed files with 12 additions and 7 deletions

View file

@ -76,7 +76,7 @@ def main(first_time:bool=True, previous_config = None):
for i in range(0, int(previous_config[1])): for i in range(0, int(previous_config[1])):
players.append(PLAYER(screen_handler.console_input( players.append(PLAYER(screen_handler.console_input(
f'Name for Player {i + 1}: In der kürze liegt die Würze \ 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])): for i in range(0, int(previous_config[2])):
players.append(BOT(f'Bot {i + 1}', i + 1, [])) players.append(BOT(f'Bot {i + 1}', i + 1, []))

View file

@ -108,7 +108,7 @@ def config_sequence(screen:Matrix):
config[question_no + 1] = input config[question_no + 1] = input
previous_question = i previous_question = i
question_no += 1 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])}" {5 - int(config[1])}"
return config return config
@ -303,8 +303,14 @@ def player_interface(screen:Matrix, player:PLAYER, round_no:int, stich:int,
{player.get_points()}") {player.get_points()}")
draw_player_cards(screen, player.get_cards()) draw_player_cards(screen, player.get_cards())
screen.print() screen.print()
wrong_input = True
while wrong_input:
chosen_card = console_input("Choose a card by its number", "[1 - " +\ chosen_card = console_input("Choose a card by its number", "[1 - " +\
str(len(player.get_cards())) + "]", screen, fullscreen=True) 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) return player.pop_card(int(chosen_card) - 1)
def bot_interface(screen:Matrix, bot:BOT, round_no:int, stich:int): def bot_interface(screen:Matrix, bot:BOT, round_no:int, stich:int):
@ -341,10 +347,9 @@ def winner_screen(screen, winner, players:list):
''' '''
screen.refresh() screen.refresh()
screen.set_frame(int(Terminal.get_columns() / 2 - 25), screen.set_frame(int(Terminal.get_columns() / 2 - 25),
int(Terminal.get_lines() / 2 - 10), 50, 20, rounded=True, int(Terminal.get_columns() / 2 - 25), 50, 20, rounded=True,
title=f"Player '{winner.get_name()}' won the game!") title=f"Player '{winner.get_name()}' won the game!")
screen.set_string_center(4, "Congratulations!") screen.set_string_center(int(Terminal.get_columns() / 2), "Congratulations!")
screen.set_string_center(5, f"Player '{winner.get_name()}' won the game!")
screen.print() screen.print()
def trumpf_screen(screen:Matrix, trumpf:str): def trumpf_screen(screen:Matrix, trumpf:str):