-
Notifications
You must be signed in to change notification settings - Fork 3
/
business-5.py
77 lines (57 loc) · 1.68 KB
/
business-5.py
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
from sys import exit, argv
script, player_name = argv
def start(player_name):
s1 = """
Greetings %s, Welcome to
Business game. The idea of this game
is to know how you would utilize the money.
The Goal is to make good use of money and also
enjoy life and yet make enough profits.
So ready to roll ?(yes/no)
""" % player_name
s2 = """
I have no idea what you typed, You were suppose
to type yes/no, okay your choice, do visit the game
again when in good mood. Ciao %s
""" % player_name
s3 = """
Okay %s, Good bye
""" % player_name
print s1
ok_start = raw_input("[yes]/no ")
if ok_start == '' or ok_start == 'yes' or ok_start == 'Yes':
start_game = True
elif ok_start == 'no' or ok_start == 'No' or ok_start == "NO":
start_game = False
else:
print s2
if ok_start == 'Yes' or ok_start == 'YES' or ok_start == 'yes':
rules(player_name)
if ok_start == 'No' or ok_start == 'NO' or ok_start == 'no':
print s3
exit(0)
def rules(player_name):
print """
Okay %s, Here are rules:
-> You will be given 5000$, which you would have to invest
-> Based on your Investment pattern, You will be awarded points
-> You will be rolling a die, depending on the number you get , you
will be shown different options to invest/spend, have to choose the option
""" % player_name
initialize(player_name)
def initialize(player_name):
base_amount = 5000
points_lost = 0
points_gained = 0
number = rol_die()
play_game(base_amount,points_lost,points_gained,number)
def rol_die():
die = random.randint(1, 6)
return die
def play_game(*args):
n1, n2, n3, n4 = args
print "n1 = %d" % n1
print "n2 = %d" % n2
print "n3 = %d" % n3
print "n4 = %d" % n4
start(player_name)