This repository was archived by the owner on Oct 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
85 lines (74 loc) · 2.12 KB
/
Copy pathmain.py
File metadata and controls
85 lines (74 loc) · 2.12 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import random
import os
import json
import time
from CoinFlip import CoinFlip
from BlackJack import BlackJack
from Slot import Slots
from SaveHandling import *
def PickUserOptions(choice, coins):
options = [
'1', #Coin FLip
'2', #BlackJack
'3', #Slot
'work' #Getting coins
]
Clear()
if choice in options:
if choice == '1':
handle_game(CoinFlip, coins)
elif choice == '2':
handle_game(BlackJack, coins)
elif choice == '3':
handle_game(Slots, coins)
elif choice == 'work':
handle_game(working, coins)
else:
#not an option, return error
Clear()
MainMenu('Not A Valid Option')
#Main Menu of game
def MainMenu(ErrorMessage: str):
while True:
Clear()
if ErrorMessage:
print('ERROR: ', ErrorMessage, '\n')
UserData = get_user_data()
coins = UserData['coins']
print("Get Coins by typing 'Work'")
print('Coin Amount: ', coins)
print('Coin Flip: 1 \nBlackJack: 2 \nSlot Machine: 3')
print("Type the # of the game you'd like to play below.")
user_input: str = input('Type an Option: ').lower()
PickUserOptions(user_input, coins)
continue
def working(coins):
total_count = 0
count = 0
while True:
Clear()
total_count += 50
count += 1
print('You got', total_count, 'coins!')
time.sleep(1)
if count >= 5:
user_input = input('Type (Yes/No) if you want to continue: ').lower()
if user_input == 'yes':
count = 0
continue
elif user_input == 'no':
break
return total_count + coins
def handle_game(game, coins):
coin_change = game(coins)
adjust_coins(coin_change)
return MainMenu(None)
def Clear():
"""
Clear Terminal
"""
os.system('cls')
if __name__ == '__main__':
UserData = get_user_data()
coins = UserData['coins']
MainMenu(None)