-
Notifications
You must be signed in to change notification settings - Fork 303
Expand file tree
/
Copy patharcade.py
More file actions
50 lines (36 loc) · 1.29 KB
/
arcade.py
File metadata and controls
50 lines (36 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import sys
from rps import rps
from guess_number import guess_number
def play_game(name='PlayerOne'):
welcome_back = False
while True:
if welcome_back == True:
print(f"\n{name}, welcome back to the Arcade menu.")
playerchoice = input(
"\nPlease choose a game:\n1 = Rock Paper Scissors\n2 = Guess My Number\n\nOr press \"x\" to exit the Arcade\n\n"
)
if playerchoice not in ["1", "2", "x"]:
print(f"\n{name}, please enter 1, 2, or x.")
return play_game(name)
welcome_back = True
if playerchoice == "1":
rock_paper_scissors = rps(name)
rock_paper_scissors()
elif playerchoice == "2":
guess_my_number = guess_number(name)
guess_my_number()
else:
print("\nSee you next time!\n")
sys.exit(f"Bye {name}! 👋")
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(
description="Provides a personalized game experience."
)
parser.add_argument(
'-n', '--name', metavar='name',
required=True, help='The name of the person playing the game.'
)
args = parser.parse_args()
print(f"\n{args.name}, welcome to the Arcade! 🤖")
play_game(args.name)