added return value for initialize() a second time
and first change to clean_input.py
This commit is contained in:
parent
9549583f28
commit
75ce84e094
|
@ -71,3 +71,44 @@ def io_int(message: str) -> int:
|
|||
|
||||
except (ValueError, NameError):
|
||||
print("Eingabe nicht gültig, bitte wiederhole deine Eingabe.")
|
||||
|
||||
def io_list(message: str, options: list):
|
||||
"""
|
||||
check card selection
|
||||
:param message: 1a
|
||||
:param options: [{'id': 3, 'number': 0, 'letter': 'd'}, {'id': 9, 'number': 1, 'letter': 'b'}]
|
||||
:return:
|
||||
"""
|
||||
while True:
|
||||
try:
|
||||
i = str(input(message))
|
||||
|
||||
except (ValueError, NameError):
|
||||
i = 0
|
||||
print("Eingabe nicht gültig, bitte wiederhole deine Eingabe.")
|
||||
|
||||
if i in options:
|
||||
return i
|
||||
|
||||
else:
|
||||
if i == "q":
|
||||
print(
|
||||
"---------------------\nSpiel wird beendet...\n---------------------")
|
||||
sys.exit()
|
||||
elif i == "r":
|
||||
print(
|
||||
"---------------------\nSpiel wird neu gestartet...\n---------------------")
|
||||
quartett.main()
|
||||
else:
|
||||
print('Noch nicht ganz richtig. Hast du deine Auswahl auch richtig geschrieben?')
|
||||
|
||||
def define_card_stack():
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
for i in range(4):
|
||||
for l in "abcdefgh":
|
||||
d = {"id": x, "number": i, "letter": l}
|
||||
card_stack.append(d)
|
||||
x += 1
|
14
quartett.py
14
quartett.py
|
@ -12,16 +12,10 @@ def central_function():
|
|||
active = 0 # contains index of the active player
|
||||
|
||||
card_stack, players_with_cards, players = initialize()
|
||||
# print(card_stack)
|
||||
# print(str(len(card_stack)))
|
||||
#
|
||||
# print(players_with_cards)
|
||||
# print(str(len(players_with_cards)))
|
||||
#
|
||||
# print(players)
|
||||
|
||||
#while deckP1 and deckP2 and deckP3 not empty:
|
||||
# round(..., players_with_cards, players)
|
||||
..., players_with_cards, players = initialize()[0], initialize()[1], initialize()[2]
|
||||
while deckP1 and deckP2 and deckP3 not empty:
|
||||
round(..., players_with_cards, players)
|
||||
# TO DO implement active_player rotation
|
||||
|
||||
|
||||
|
@ -95,9 +89,9 @@ def initialize():
|
|||
# Add list of dicts (cards) to players
|
||||
players_with_cards.append({"player": players[i], "cards_on_hand": cards_of_player})
|
||||
|
||||
|
||||
return card_stack, players_with_cards, players
|
||||
|
||||
central_function()
|
||||
'''
|
||||
players_with_cards = [
|
||||
{'player': 'player0', 'cards_on_hand': [{'id': 13, 'number': 1, 'letter': 'f'},
|
||||
|
|
Loading…
Reference in New Issue