-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbetmachine.py
103 lines (75 loc) · 1.59 KB
/
betmachine.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import random
#from collections import deque
import numpy as np
MAX_LINES=3
table=[]
x='💣'
y='🍫'
z='🎊'
w='⏰'
def machine():
A={x:2,y:4,y:6,z:8}
item = [i for i, j in A.items() for _ in range(j)]
#print(item)
#B=deque(item)
B=item[:]
#f=random.choice(B)
#p=lambda x:B.remove(x)4
global table
table=[[ B.pop(random.randrange(len(B))) for _ in range (3)] for _ in range(3)]
#table1=np.array(table).transpose()
#print('\n'.join([' | '.join(i) for i in table1]))
#print(table)
#print(*( i for i in table))
length =len(table[0])
print( '\n'.join(' | '.join(j[i] for j in table)for i in range(length)))
def check():
A={x:5,y:4,y:3,z:2}
win=0
for i in range(l):
for j in table:
if table[0][i]!=j[i]:
break
else:
win+=A[j[i]]*a
c =c+win
def credit():
global c
while True:
c=input("how much credit do you have? $")
if c.isdigit():
c=int(c)
if c<=0:
print("insuffient amount")
else:
break
else :
print("INVALID!!")
def lines():
global l
while True :
l = input(f"how many lines to beton (upto{MAX_LINES}) ")
if l.isdigit():
l=int(l)
if 1<l<=MAX_LINES:
break
else:
print("inavlid value")
else :
print("INVALID!")
def balance():
global a
while True:
a=input("how much do you like bet? $")
if a.isdigit():
a=int(a)
if a<=0 or a*l>c :
print("insuffient balance")
else:
break
else :
print("INVALID !!")
credit()
lines()
balance()
machine()