Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 103 additions & 13 deletions lib/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,110 @@

def main():
while True:
menu()
enter_bar()

option_select()

#verifies valid choice
def get_valid_choice(valid_options):
#keep asking until a valid choice is entered
while True:
choice = input("> ")
if choice == "0":
exit_program()
elif choice == "1":
age_checker()
else:
print("Invalid choice")


def menu():
print("Please select an option:")
print("0. Exit the program")
print("1. Can Drink?")
if choice in valid_options:
return choice
print("Invalid choice, please try again")

#entering the bar
def enter_bar():
print("\nPlease select an option:")
print("0. Leave")
print("1. Can I see your ID?")

choice = get_valid_choice(["0", "1"])
if choice == "0":
exit_program()
elif choice == "1":
age_checker()

#main option select
def option_select():
print("\n Options")
#change later to only show if tab is open
print("0. Close Your Tab")
print("1. Can I get a drink?")
#hint for leaving if your tab is open
print("\nhint: to leave, close your tab")

choice = get_valid_choice(["0", "1"])
if choice == "0":
close_tab()
elif choice == "1":
select_drink()

#drink selection options
def select_drink():
print("\n Options:")
print("0. Go Back")
print("1. Cosmo")
print("2. Manhattan")
print("3. Tequila Sunrise")
print("4. Rum Runner")
print("5. Bees Knees")

choice = get_valid_choice(["0", "1", "2", "3", "4", "5"])
if choice == "0":
option_select()
else:
drinks = {
"1": "Cosmo",
"2": "Manhattan",
"3": "Tequila Sunrise",
"4": "Rum Runner",
"5": "Bees Knees"
}
print(f"\n{drinks[choice]}, right up!")
open_tab()

def open_tab():
print("Would you like to open a tab?")
print("0. yes")
print("1. no")

choice = get_valid_choice(["0", "1"])
if choice == "0":
print("Opening tab!")
else:
print("Here's your total: total")

print("Press enter to continue")
user_input = input()
option_select()

#shows option to close tab, change later to show up if drinks are added to tab
def close_tab():
print("\n Are you sure?:")
print("0. Yes")
print("1. No")

choice = get_valid_choice(["0", "1"])
if choice == "0":
leave_bar()
elif choice == "1":
option_select()

#leaving the bar
def leave_bar():
#show this if just closing tab
print("\nClosing Tab!")
print(" Would you like to leave?")
print("0. yes")
print("1. no")

choice = get_valid_choice(["0", "1"])
if choice == "0":
exit_program()
elif choice == "1":
option_select()


if __name__ == "__main__":
Expand Down
9 changes: 5 additions & 4 deletions lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
from debug import Johnathan

def age_checker():
if Johnathan.age > 21:
print("Can Drink")
if Jay.age > 21:
print("\nWelcome in!")
else:
print("Sorry gotta go")
print("\nSorry gotta go!")
exit()


def exit_program():
print("Goodbye!")
print("\n See ya later!")
exit()