2020-12-09 11:24:01 +01:00
|
|
|
"""clean_input"""
|
|
|
|
|
2020-12-10 10:13:16 +01:00
|
|
|
import sys
|
2020-12-10 11:48:42 +01:00
|
|
|
import game.py
|
2020-12-09 11:24:01 +01:00
|
|
|
|
|
|
|
#message needs to be a string that is printed for user instruction. options is a list of viable inputs
|
|
|
|
def io(message: str, options: list) -> str:
|
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
i = str(input(message))
|
|
|
|
|
|
|
|
except (ValueError, NameError):
|
|
|
|
print("Eingabe nicht gültig, bitte wiederhole deine Eingabe.")
|
|
|
|
|
|
|
|
if i in options:
|
|
|
|
return i
|
|
|
|
break
|
2020-12-10 10:13:16 +01:00
|
|
|
|
2020-12-09 11:24:01 +01:00
|
|
|
else:
|
2020-12-10 10:13:16 +01:00
|
|
|
try:
|
|
|
|
print('Noch nicht ganz richtig. Hast du deine Auswahl auch richtig geschrieben?')
|
|
|
|
|
2020-12-10 11:48:42 +01:00
|
|
|
except(i =='q' or i == 'r'):
|
2020-12-10 10:13:16 +01:00
|
|
|
|
2020-12-10 11:48:42 +01:00
|
|
|
if i == 'q':
|
2020-12-10 10:13:16 +01:00
|
|
|
print("Spiel wird beendet...")
|
|
|
|
sys.exit()
|
|
|
|
|
2020-12-10 11:48:42 +01:00
|
|
|
if i == 'r':
|
2020-12-10 10:13:16 +01:00
|
|
|
print("Spiel wird neu gestartet...")
|
2020-12-10 11:48:42 +01:00
|
|
|
#game.main()
|
2020-12-09 11:24:01 +01:00
|
|
|
|
|
|
|
|