1
0
Fork 0

add more cases for comamnds

This commit is contained in:
Lili (Tlapka) 2021-03-30 13:33:47 +02:00
parent cd5890d10a
commit 2ed5c6b1f5
1 changed files with 9 additions and 9 deletions

View File

@ -260,15 +260,15 @@ def game_loop():
print("Waiting for your input:") print("Waiting for your input:")
command = input() command = input()
command = command.lower() command = command.lower()
if command in ("a", "abort"): if command in ("a", "abort", "(a)bort"):
abort_game(game, hint_giver) abort_game(game, hint_giver)
elif command in ("e", "exit"): elif command in ("e", "exit"):
abort_game(game, hint_giver) abort_game(game, hint_giver)
print("Exiting...") print("Exiting...")
return return
elif command in ("s", "start"): elif command in ("s", "start", "(s)tart"):
start_game(game, level_selector) start_game(game, level_selector)
elif command in ("n", "next"): elif command in ("n", "next", "(n)ext"):
try: try:
if game.level == 0: if game.level == 0:
print("Can't continue, (S)tart the game first!") print("Can't continue, (S)tart the game first!")
@ -290,17 +290,17 @@ def game_loop():
print("Make sure to run (F)inish and (L)og your progress before exiting.") print("Make sure to run (F)inish and (L)og your progress before exiting.")
except NoLevelFoundError as err: except NoLevelFoundError as err:
print("Error encountered: {}".format(err)) print("Error encountered: {}".format(err))
elif command in ("f", "finish"): elif command in ("f", "finish", "(f)inish"):
finish_game(game) finish_game(game)
elif command in ("i", "info", "information"): elif command in ("i", "info", "information", "(i)nfo", "(i)nformation"):
game.print_info() game.print_info()
elif command in ("h", "help"): elif command in ("h", "help", "(h)elp"):
print_help() print_help()
elif command in ("c", "check"): elif command in ("c", "check", "(c)heck"):
check_prerequisites() check_prerequisites()
elif command in ("l", "log"): elif command in ("l", "log", "(l)og"):
write_log(game, hint_giver) write_log(game, hint_giver)
elif command in ("t", "hint"): elif command in ("t", "hint", "hin(t)"):
give_hint(game, hint_giver) give_hint(game, hint_giver)
else: else:
print("Unknown command. Enter another command or try (H)elp.") print("Unknown command. Enter another command or try (H)elp.")