-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.py
More file actions
85 lines (67 loc) · 2.46 KB
/
game.py
File metadata and controls
85 lines (67 loc) · 2.46 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
from reports.report_generator import report_generator
"""
Elementy gry: gracze, strategia gracza, krupier, ruletka
"""
from play.player import player
from play.strategy import strategy
from croupier import croupier
from games.roulette import roulette
from itertools import combinations_with_replacement
n = [k for k in range(0, 9)]
k = 3
games = list(combinations_with_replacement(n, k))
"""
profit_3_3, three incomes, profitable strategy
profit_3_2, two incomes, profitable strategy
profit_3_1, one income, profitable strategy
noprofit_3_2, two incomes, inprofitable strategy
noprofit 3_1, one incomes, inprofitable strategy
noprofit_3_0, zero income, inprofitable strategy
"""
profit_3_3 = []
profit_3_2 = []
profit_3_1 = []
roulette = roulette()
croupier = croupier()
profit_sum = 0
game_number = 0;
for result_series in games:
print ("\n \n new serie start")
game_number+=1
player_strategy = strategy(roulette)
player_michal = player("Michal", 50, player_strategy)
profit_count = 0;
first_account = player_michal.get_account()
if result_series == (3, 4, 5):
print "siemanko"
for result in result_series:
print("\n new result")
before = player_michal.get_account()
croupier.add_player(player_michal)
roulette.set_result(result) # ustawienie rezultatu stan ruletki i poznaje rezultat
croupier.pay_for_matches(roulette, player_michal) # na podstawie rezultatu krupier wyplaca graczom kwoty
player_michal.get_next_bet()
if player_michal.get_account() > 0:
profit_sum += player_michal.get_account()
else:
break
after = player_michal.get_account()
if after > before:
profit_count+=1
if profit_count == 1 and first_account < player_michal.get_account():
profit_3_1.append(player_michal.get_account())
elif profit_count == 2 and first_account < player_michal.get_account():
profit_3_2.append(player_michal.get_account())
elif profit_count == 3 and first_account < player_michal.get_account():
profit_3_3.append(player_michal.get_account())
player_michal.get_account()
# import numpy
# a = numpy.mean(profit_3_3)
# b = numpy.mean(profit_3_2)
# c = numpy.mean(profit_3_1)
#TODO: czemu dla analogicznych strategii sa rozne wyniki np 12/1: 10, 3/15: 20/17, 15:20
#
# print("profit_3_3 mean:" +str(a))
# print("profit_3_2 mean:" +str(b))
# print("profit_3_1 mean:" +str(c))
# print("profit sum: "+str(profit_sum))