implemented Scoundrel game

This commit is contained in:
Luxferre
2026-01-02 12:36:36 +02:00
parent 7ae7beeb9b
commit f66d94b8b0
4 changed files with 198 additions and 4 deletions
+15 -3
View File
@@ -16,6 +16,20 @@ _idx_map = {
'0': 9, 'p': 9
}
def confirm(msg, yes='y', no='n', alt_prompt=None):
prompt=f' ({yes}/{no}) '
yes = yes.lower()
no = no.lower()
if alt_prompt is not None:
prompt = alt_prompt
final_prompt = msg + prompt
while True:
choice = input(final_prompt).strip().lower()
if choice == yes:
return True
elif choice == no:
return False
def menu(choices, max_size = 10):
"""
Presents a menu of choices and prompts for numeric or
@@ -49,6 +63,4 @@ def menu(choices, max_size = 10):
return menu(choices)
else:
print('Invalid choice!')
return menu(choices)
return menu(choices)