-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlottonumber.py
255 lines (208 loc) · 7.57 KB
/
lottonumber.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
import time
start = time.time()
import sqlite3
import random
from datetime import datetime
minutes = datetime.now().strftime('%M')
minutes = int(int(minutes)/2)+1
conn = sqlite3.connect('lottoX.db')
c = conn.cursor()
c.execute('CREATE TABLE IF NOT EXISTS lotto (num_1 number,num_2 number,num_3 number,num_4 number,num_5 number, euro_1 number, euro_2 number)')
conn.commit()
def random_lotto():
random_lotto = []
for i in range(1,50):
x = random.randint(1,50)
random_lotto.append(x)
#for iterator in range(1,int(minutes)):
# random.shuffle(random_lotto)
return random_lotto
def random_euro():
random_euro = []
for i in range(1,10):
x = random.randint(1,10)
random_euro.append(x)
#for iterator in range(1,int(minutes/2)):
# random.shuffle(random_euro)
return random_euro
def odd(num):
if num % 2 == 0:
return False # Even
else:
return True # Odd
def high(num):
if num < 25:
return False # Low
else:
return True # High
def picked(lotto_list,num):
if num in lotto_list:
return True
else:
return False
def count_low(lotto_list):
count = 0
for num in lotto_list:
if not high(num):
count += 1
return count
def count_high(lotto_list):
count = 0
for num in lotto_list:
if high(num):
count += 1
return count
def count_odd(lotto_list):
count = 0
for num in lotto_list:
if odd(num):
count += 1
return count
def count_even(lotto_list):
count = 0
for num in lotto_list:
if not odd(num):
count += 1
return count
def all_random(lotto_nums,euro_num):
lotto_list = lotto_nums[:5]
euro_list = euro_num[:2]
lotto_list = lotto_list + euro_list
return (lotto_list)
def strat_low_high_even_odd(lotto_nums,euro_num):
# 3 low 2 high
# 3 odd 2 even
lotto_list = []
euro_list = []
for num in lotto_nums:
if count_high(lotto_list) < 2 and picked(lotto_list,num) == False and high(num):
if odd(num) and count_odd(lotto_list) < 3:
lotto_list.append(num)
elif not odd(num) and count_even(lotto_list) < 2:
lotto_list.append(num)
if count_low(lotto_list) < 3 and picked(lotto_list,num) == False and not high(num):
if odd(num) and count_odd(lotto_list) < 3:
lotto_list.append(num)
elif not odd(num) and count_even(lotto_list) < 2:
lotto_list.append(num)
for num in euro_num:
if len(euro_list) < 2 and picked(euro_list,num) == False :
euro_list.append(num)
lotto_list = lotto_list + euro_list
return (lotto_list)
def strat_low_high_odd_even(lotto_nums,euro_num):
# 3 low 2 high
# 2 odd 3 even
lotto_list = []
euro_list = []
for num in lotto_nums:
if count_high(lotto_list) < 2 and picked(lotto_list,num) == False and high(num):
if odd(num) and count_odd(lotto_list) < 2:
lotto_list.append(num)
elif not odd(num) and count_even(lotto_list) < 3:
lotto_list.append(num)
if count_low(lotto_list) < 3 and picked(lotto_list,num) == False and not high(num):
if odd(num) and count_odd(lotto_list) < 2:
lotto_list.append(num)
elif not odd(num) and count_even(lotto_list) < 3:
lotto_list.append(num)
for num in euro_num:
if len(euro_list) < 2 and picked(euro_list,num) == False :
euro_list.append(num)
lotto_list = lotto_list + euro_list
return (lotto_list)
def strat_high_low_odd_even(lotto_nums,euro_num):
# 2 low 3 high
# 3 odd 2 even
lotto_list = []
euro_list = []
for num in lotto_nums:
if count_high(lotto_list) < 3 and picked(lotto_list,num) == False and high(num):
if odd(num) and count_odd(lotto_list) < 3:
lotto_list.append(num)
elif not odd(num) and count_even(lotto_list) < 2:
lotto_list.append(num)
if count_low(lotto_list) < 2 and picked(lotto_list,num) == False and not high(num):
if odd(num) and count_odd(lotto_list) < 3:
lotto_list.append(num)
elif not odd(num) and count_even(lotto_list) < 2:
lotto_list.append(num)
for num in euro_num:
if len(euro_list) < 2 and picked(euro_list,num) == False :
euro_list.append(num)
lotto_list = lotto_list + euro_list
return (lotto_list)
def strat_high_low_even_odd(lotto_nums,euro_num):
# 2 low 3 high
# 2 odd 3 even
lotto_list = []
euro_list = []
for num in lotto_nums:
if count_high(lotto_list) < 3 and picked(lotto_list,num) == False and high(num):
if odd(num) and count_odd(lotto_list) < 2:
lotto_list.append(num)
elif not odd(num) and count_even(lotto_list) < 3:
lotto_list.append(num)
if count_low(lotto_list) < 3 and picked(lotto_list,num) == False and not high(num):
if odd(num) and count_odd(lotto_list) < 2:
lotto_list.append(num)
elif not odd(num) and count_even(lotto_list) < 3:
lotto_list.append(num)
for num in euro_num:
if len(euro_list) < 2 and picked(euro_list,num) == False :
euro_list.append(num)
lotto_list = lotto_list + euro_list
return (lotto_list)
for x in range(0,100000000000):
try:
for y in range(0,7500):
random_lotto_list = random_lotto()
random_euro_list = random_euro()
lotto_list = strat_low_high_even_odd(random_lotto_list,random_euro_list)
if len(lotto_list) == 7:
query = 'INSERT INTO lotto VALUES (?,?,?,?,?,?,?);'
c.execute(query, lotto_list)
else:
pass
for y in range(0,7500):
random_lotto_list = random_lotto()
random_euro_list = random_euro()
lotto_list = strat_low_high_odd_even(random_lotto_list,random_euro_list)
if len(lotto_list) == 7:
query = 'INSERT INTO lotto VALUES (?,?,?,?,?,?,?);'
c.execute(query, lotto_list)
else:
pass
for y in range(0,7500):
random_lotto_list = random_lotto()
random_euro_list = random_euro()
lotto_list = strat_high_low_even_odd(random_lotto_list,random_euro_list)
if len(lotto_list) == 7:
query = 'INSERT INTO lotto VALUES (?,?,?,?,?,?,?);'
c.execute(query, lotto_list)
else:
pass
for y in range(0,7500):
random_lotto_list = random_lotto()
random_euro_list = random_euro()
lotto_list = strat_high_low_odd_even(random_lotto_list,random_euro_list)
if len(lotto_list) == 7:
query = 'INSERT INTO lotto VALUES (?,?,?,?,?,?,?);'
c.execute(query, lotto_list)
else:
pass
for y in range(0,7500):
random_lotto_list = random_lotto()
random_euro_list = random_euro()
lotto_list = all_random(random_lotto_list,random_euro_list)
if len(lotto_list) == 7:
query = 'INSERT INTO lotto VALUES (?,?,?,?,?,?,?);'
c.execute(query, lotto_list)
else:
pass
conn.commit()
except ValueError as e:
pass
elapsed_time_lc=(time.time()-start)
print("------------> ",elapsed_time_lc)
conn.close()