-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplay.py
50 lines (32 loc) · 904 Bytes
/
play.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
#!/usr/bin/env python
""" play behavior
# ----
# License: BSD
# ----
# 0.1: init version - 2016.6 - by Nick Qian
"""
def compare(number_pair):
if number_pair[0] > number_pair[1]:
return 1
elif number_pair[0] < number_pair[1]:
return -1
def gen_compareResult(times):
list_pair = gen_randomList(times)
list_result = []
for i in range(0, times):
number_pair = [list_pair[i], list_pair[i*2] ]
list_result.append( compare(number_pair ) )
return list_result
def play_once(list_result, bet, rate, moneyIn):
WinLostOnce = iter[list_result]
yield (moneyIn + (bet * rate)*WinLostOnce.next() )
def play_oneSection():
moneyIn = 1
bet = 1
rate = 2
gen_compareResult(1000000)
while True:
currentResult = play_once(list_result, bet, moneyIn)
#if
if __name__ == "__main__":
play_oneSection()