-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscratch.py
151 lines (121 loc) · 8.96 KB
/
scratch.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
# Oct 2020
import networkx as nx
import matplotlib.pyplot as plt
from helper_fns import *
# Optimal relationships in both seasons
beta_optimality = [
[0.5, 0.5219, 0.5048, 0.4234, 0.389, 0.4148, 0.4626, 0.6031, 0.6107, 0.3839, 0.4375, 0.4183, 0.5543, 0.4445, 0.4806, 0.3239, 0.4793, 0.4277, 0.4369, 0.3203, 0.4048, 0.472, 0.3372, 0.3535, 0.3614, 0.3009, 0.3509, 0.3416],
[0.4781, 0.5, 0.4926, 0.3857, 0.419, 0.4352, 0.435, 0.5766, 0.585, 0.448, 0.4904, 0.481, 0.5765, 0.492, 0.5216, 0.3419, 0.521, 0.4639, 0.4849, 0.3881, 0.4486, 0.5085, 0.4639, 0.3573, 0.4335, 0.3714, 0.4184, 0.389],
[0.4952, 0.5074, 0.5, 0.3989, 0.4523, 0.3333, 0.4629, 0.583, 0.5927, 0.4697, 0.5273, 0.4045, 0.5766, 0.5145, 0.6118, 0.407, 0.4598, 0.4904, 0.5104, 0.4563, 0.4274, 0.5481, 0.4681, 0.3497, 0.4608, 0.3891, 0.486, 0.3707],
[0.5766, 0.6143, 0.6011, 0.5, 0.4634, 0.4573, 0.5493, 0.6839, 0.6547, 0.5046, 0.5058, 0.4741, 0.6396, 0.6273, 0.6793, 0.3702, 0.5767, 0.4244, 0.6063, 0.408, 0.5557, 0.5428, 0.4776, 0.4201, 0.481, 0.3756, 0.3588, 0.4058],
[0.611, 0.581, 0.5477, 0.5366, 0.5, 0.4793, 0.5361, 0.6494, 0.6175, 0.6109, 0.5717, 0.5377, 0.6256, 0.4582, 0.6269, 0.4527, 0.4747, 0.4906, 0.5409, 0.4519, 0.4949, 0.5458, 0.5083, 0.4933, 0.4969, 0.4312, 0.4741, 0.4366],
[0.5852, 0.5648, 0.6667, 0.5427, 0.5207, 0.5, 0.6392, 0.6544, 0.6741, 0.552, 0.6011, 0.5177, 0.6474, 0.4605, 0.7031, 0.4247, 0.5126, 0.5329, 0.5876, 0.4192, 0.645, 0.5993, 0.5721, 0.4614, 0.5291, 0.4508, 0.5333, 0.474],
[0.5374, 0.565, 0.5371, 0.4507, 0.4639, 0.3608, 0.5, 0.6615, 0.6797, 0.5226, 0.57, 0.4653, 0.6641, 0.5827, 0.5911, 0.4217, 0.507, 0.5585, 0.5697, 0.476, 0.4566, 0.6058, 0.5291, 0.4228, 0.5058, 0.3981, 0.5071, 0.4007],
[0.3969, 0.4234, 0.417, 0.3161, 0.3506, 0.3456, 0.3385, 0.5, 0.4817, 0.2356, 0.3422, 0.3289, 0.4647, 0.38, 0.3087, 0.3018, 0.4147, 0.3136, 0.3044, 0.2759, 0.3065, 0.3531, 0.2635, 0.2556, 0.2671, 0.2576, 0.3178, 0.2844],
[0.3893, 0.415, 0.4073, 0.3453, 0.3825, 0.3259, 0.3203, 0.5183, 0.5, 0.2507, 0.4529, 0.3007, 0.4728, 0.3489, 0.3234, 0.3856, 0.3778, 0.3264, 0.3154, 0.3398, 0.278, 0.3458, 0.289, 0.286, 0.2777, 0.3072, 0.3857, 0.2653],
[0.6161, 0.552, 0.5303, 0.4954, 0.3891, 0.448, 0.4774, 0.7644, 0.7493, 0.5, 0.4476, 0.4814, 0.698, 0.5015, 0.5247, 0.2691, 0.5026, 0.3418, 0.4842, 0.3236, 0.4711, 0.4135, 0.3402, 0.3234, 0.3516, 0.2811, 0.3281, 0.3178],
[0.5625, 0.5096, 0.4727, 0.4942, 0.4283, 0.3989, 0.43, 0.6578, 0.5471, 0.5524, 0.5, 0.493, 0.5549, 0.3535, 0.5006, 0.4248, 0.4291, 0.4329, 0.4019, 0.3532, 0.413, 0.4988, 0.3711, 0.4345, 0.3974, 0.3624, 0.3922, 0.401],
[0.5817, 0.519, 0.5955, 0.5259, 0.4623, 0.4823, 0.5347, 0.6711, 0.6993, 0.5186, 0.507, 0.5, 0.6185, 0.344, 0.5625, 0.3369, 0.4755, 0.4062, 0.51, 0.3633, 0.5589, 0.5397, 0.4083, 0.3891, 0.4562, 0.3427, 0.4567, 0.4091],
[0.4457, 0.4235, 0.4234, 0.3604, 0.3744, 0.3526, 0.3359, 0.5353, 0.5272, 0.302, 0.4451, 0.3815, 0.5, 0.3532, 0.3619, 0.3216, 0.4818, 0.3418, 0.3786, 0.3178, 0.3147, 0.3715, 0.3319, 0.3195, 0.2942, 0.31, 0.3679, 0.2899],
[0.5555, 0.508, 0.4855, 0.3727, 0.5418, 0.5395, 0.4173, 0.62, 0.6511, 0.4985, 0.6465, 0.656, 0.6468, 0.5, 0.5877, 0.5042, 0.6029, 0.4243, 0.5361, 0.5054, 0.5749, 0.4468, 0.5613, 0.3637, 0.4858, 0.6113, 0.5151, 0.5098],
[0.5194, 0.4784, 0.3882, 0.3207, 0.3731, 0.2969, 0.4089, 0.6913, 0.6766, 0.4753, 0.4994, 0.4375, 0.6381, 0.4123, 0.5, 0.2614, 0.423, 0.2169, 0.3953, 0.3043, 0.3666, 0.3378, 0.3799, 0.221, 0.2559, 0.2919, 0.1858, 0.2248],
[0.6761, 0.6581, 0.593, 0.6298, 0.5473, 0.5753, 0.5783, 0.6982, 0.6144, 0.7309, 0.5752, 0.6631, 0.6784, 0.4958, 0.7386, 0.5, 0.6974, 0.5068, 0.6122, 0.3965, 0.6307, 0.531, 0.5718, 0.6232, 0.6201, 0.5578, 0.4463, 0.6029],
[0.5207, 0.479, 0.5402, 0.4233, 0.5253, 0.4874, 0.493, 0.5853, 0.6222, 0.4974, 0.5709, 0.5245, 0.5182, 0.3971, 0.577, 0.3026, 0.5, 0.3868, 0.5758, 0.4408, 0.6441, 0.4749, 0.5145, 0.3803, 0.4454, 0.4845, 0.4631, 0.4553],
[0.5723, 0.5361, 0.5096, 0.5756, 0.5094, 0.4671, 0.4415, 0.6864, 0.6736, 0.6582, 0.5671, 0.5938, 0.6582, 0.5757, 0.7831, 0.4932, 0.6132, 0.5, 0.696, 0.4203, 0.5326, 0.5017, 0.6129, 0.5474, 0.654, 0.4714, 0.4726, 0.4624],
[0.5631, 0.5151, 0.4896, 0.3937, 0.4591, 0.4124, 0.4303, 0.6956, 0.6846, 0.5158, 0.5981, 0.49, 0.6214, 0.4639, 0.6047, 0.3878, 0.4242, 0.304, 0.5, 0.3919, 0.4647, 0.4291, 0.4594, 0.2885, 0.4031, 0.3662, 0.3543, 0.3107],
[0.6797, 0.6119, 0.5437, 0.592, 0.5481, 0.5808, 0.524, 0.7241, 0.6602, 0.6764, 0.6468, 0.6367, 0.6822, 0.4946, 0.6957, 0.6035, 0.5592, 0.5797, 0.6081, 0.5, 0.6238, 0.5425, 0.59, 0.5868, 0.5709, 0.5574, 0.5382, 0.5864],
[0.5952, 0.5514, 0.5726, 0.4443, 0.5051, 0.355, 0.5434, 0.6935, 0.722, 0.5289, 0.587, 0.4411, 0.6853, 0.4251, 0.6334, 0.3693, 0.3559, 0.4674, 0.5353, 0.3762, 0.5, 0.5472, 0.5513, 0.3339, 0.4719, 0.3041, 0.4623, 0.3678],
[0.528, 0.4915, 0.4519, 0.4572, 0.4542, 0.4007, 0.3942, 0.6469, 0.6542, 0.5865, 0.5012, 0.4603, 0.6285, 0.5532, 0.6622, 0.469, 0.5251, 0.4983, 0.5709, 0.4575, 0.4528, 0.5, 0.5065, 0.4366, 0.5063, 0.4057, 0.509, 0.3903],
[0.6628, 0.5361, 0.5319, 0.5224, 0.4917, 0.4279, 0.4709, 0.7365, 0.711, 0.6598, 0.6289, 0.5917, 0.6681, 0.4387, 0.6201, 0.4282, 0.4855, 0.3871, 0.5406, 0.41, 0.4487, 0.4935, 0.5, 0.4818, 0.4817, 0.4188, 0.3806, 0.395],
[0.6465, 0.6427, 0.6503, 0.5799, 0.5067, 0.5386, 0.5772, 0.7444, 0.714, 0.6766, 0.5655, 0.6109, 0.6805, 0.6363, 0.779, 0.3768, 0.6197, 0.4526, 0.7115, 0.4132, 0.6661, 0.5634, 0.5182, 0.5, 0.5794, 0.4298, 0.3813, 0.4166],
[0.6386, 0.5665, 0.5392, 0.519, 0.5031, 0.4709, 0.4942, 0.7329, 0.7223, 0.6484, 0.6026, 0.5438, 0.7058, 0.5142, 0.7441, 0.3799, 0.5546, 0.346, 0.5969, 0.4291, 0.5281, 0.4937, 0.5183, 0.4206, 0.5, 0.4187, 0.3778, 0.39],
[0.6991, 0.6286, 0.6109, 0.6244, 0.5688, 0.5492, 0.6019, 0.7424, 0.6928, 0.7189, 0.6376, 0.6573, 0.69, 0.3887, 0.7081, 0.4422, 0.5155, 0.5286, 0.6338, 0.4426, 0.6959, 0.5943, 0.5812, 0.5702, 0.5813, 0.5, 0.5122, 0.5077],
[0.6491, 0.5816, 0.514, 0.6412, 0.5259, 0.4667, 0.4929, 0.6822, 0.6143, 0.6719, 0.6078, 0.5433, 0.6321, 0.4849, 0.8142, 0.5537, 0.5369, 0.5274, 0.6457, 0.4618, 0.5377, 0.491, 0.6194, 0.6187, 0.6222, 0.4878, 0.5, 0.4511],
[0.6584, 0.611, 0.6293, 0.5942, 0.5634, 0.526, 0.5993, 0.7156, 0.7347, 0.6822, 0.599, 0.5909, 0.7101, 0.4902, 0.7752, 0.3971, 0.5447, 0.5376, 0.6893, 0.4136, 0.6322, 0.6097, 0.605, 0.5834, 0.61, 0.4923, 0.5489, 0.5]
]
# fig, ax = plt.subplots(figsize=(12,12))
# im = ax.imshow(beta_optimality)
# ax.set_xticks(range(28))
# ax.set_xticklabels(pairs)
# ax.set_yticks(range(28))
# ax.set_yticklabels(pairs)
# fig.colorbar(im)
# plt.title("Initial configuration")
# plt.tight_layout()
# plt.show()
# moves_made = {}
# p = ["Rogue","Monk"]
# count = 0
# for g in db.completed_games.find({"balance_code":{"$exists":True}, "winner":{"$exists":True}}):
# p1 = [g["p1c1"], g["p1c2"]]
# p2 = [g["p2c1"], g["p2c2"]]
# if p[0] in p1 and p[1] in p1 and p[0] in p2 and p[1] in p2:
# count += 1
# else:
# continue
# move = g["Moves"][0].split("_")[0]
# if move not in moves_made.keys():
# moves_made[move] = 1
# else:
# moves_made[move] += 1
# print(moves_made)
# p = ["Rogue","Monk"]
# data = []
# data2 = []
# char_res = {}
# for char in chars:
# char_res[char] = [0]
# WR_p = 0
# WR_w = 0
# for g in db.completed_games.find({"balance_code":{"$exists":False}, "winner":{"$exists":True}}):
# p1 = [g["p1c1"][0], g["p1c2"][0]]
# p2 = [g["p2c1"][0], g["p2c2"][0]]
# # rm_used = 0
# # wr_used = 0
# # if "Rogue" in p1 and "Monk" in p1:
# # rm_used += 1
# # if "Rogue" in p2 and "Monk" in p2:
# # rm_used += 1
# # if "Rogue" in p1 and "Wizard" in p1:
# # wr_used += 1
# # if "Rogue" in p2 and "Wizard" in p2:
# # wr_used += 1
# # if len(data) == 0:
# # data += [0]
# # data2 += [0]
# # else:
# # data += [data[-1] + rm_used]
# # data2 += [data2[-1] + wr_used]
# for c in chars:
# if c in p1 and c in p2:
# char_res[c] += [char_res[c][-1] + 2]
# elif c in p1 or c in p2:
# char_res[c] += [char_res[c][-1] + 1]
# else:
# char_res[c] += [char_res[c][-1]]
# # plt.plot(data)
# # plt.plot(data2)
# # plt.plot([x*0.125 for x in range(len(data))])
# if p1 == ["W","R"] or p1 == ["R","W"]:
# WR_p += 1
# if g["winner"] == 1:
# WR_w += 1
# if p2 == ["W","R"] or p2 == ["R","W"]:
# WR_p += 1
# if g["winner"] == 2:
# WR_w += 1
# print(WR_p)
# print(WR_w)
# for c in chars:
# plt.plot(char_res[c], label=c)
# plt.plot([x*0.5 for x in range(len(char_res["K"]))])
# plt.legend()
# plt.tight_layout()
# plt.show()
users = []
for g in db.completed_games.find({"winner":{"$exists":True}, "balance_code":"1.2"}):
if g["p1c1"] in ["Archer","Rogue"] and g["p1c2"] in ["Archer","Rogue"]:
users += [g["usernames"][0]]
if g["p2c1"] in ["Archer","Rogue"] and g["p2c2"] in ["Archer","Rogue"]:
users += [g["usernames"][1]]
print(users.count("l17r"))