-
Notifications
You must be signed in to change notification settings - Fork 22
/
buy_template.html
141 lines (140 loc) · 5.89 KB
/
buy_template.html
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
$def with ( cards, player_data = None )
<html><head><title>Popular Buys</title>
<script language="javascript" type="text/javascript"
src="static/flot/jquery.js"></script>
<script language="javascript" type="text/javascript"
src="static/jquery.dataTables.js"></script>
<style type="text/css">
tr {
display: table-row;
}
table {
border-collapse: separate;
border-spacing: 2px 2px;
}
tr.odd {
background-color: #E2E4ff;
}
tr.even {
background-color: white;
}
th {
cursor: pointer;
}
th.overall {
background-color: #E2E4FF;
}
th.player {
background-color: #A3A9FF;
}
</style>
</head>
<body>
<div>
<A HREF="/">Back to CouncilRoom.com</A>
<BR>
<h1>Popular Buys</h1>
<UL><LI>"Availability" is defined as the number of games in which the card is present, multiplied by the number of players in each game. It represents the number of "decks" that could have purchased that card.
<LI>"Buys", "Gains", "Trashes", and "Returns" are defined as the total number of Buys/Gains/Trashes/Returns for the card, divided by "Availability". It represents the average number of Buys, Gains, Trashes, or Returns of that card by each player's deck.
<LI>"% +" refers to the percentage of decks in which the card was bought or gained at least once.
<LI>"Turns" refers to the average length of games in which the card was present. "Turns (C)" refers the average length in a game with Colonies.
<LI>Success is measured in Win Points: 0 for a loss, (# players) for a
win, and draws are split evenly between the winners.</LI>
<LI>"Win Rate with" is the number of Win Points per game you get when you
buy or gain at least one of this card.</LI>
<LI>"Win Rate without" is the number of Win Points per game you get when
you never buy or gain the card.</LI>
<LI>"Effect with" is the number of standard deviations better than
expected you perform when you buy or gain the card.</LI>
<LI>"Effect without" is the number of standard deviations better than
expected you perform when you never buy or gain the card.</LI>
</UL>
<form action='popular_buys' method='get'>
<input type="search" placeholder="Search by player"
name="player" style="width:200px;" />
<input type="submit" value="Go" />
</form>
<table id="popular">
<thead>
<tr>
<th> </th>
<th colspan="10" class="overall">Overall</th>
$if player_data:
<th colspan="13" class="player">Player stats</th>
</tr>
<tr>
<th class="overall">Card</th>
<th class="overall">Availability</th>
<th class="overall">Buys</th>
<th class="overall">Gains</th>
<th class="overall">% +</th>
<th class="overall">Trashes</th>
<th class="overall">Returns</th>
<th class="overall">Win Rate with</th>
<th class="overall">Win Rate without</th>
<th class="overall">Turns</th>
<th class="overall">Turns (C)</th>
$if player_data:
<th class="player">Games</th>
<th class="player">Win Rate given avail</th>
<th class="player">Buys</th>
<th class="player">Gains</th>
<th class="player">% +</th>
<th class="player">Trashes</th>
<th class="player">Returns</th>
<th class="player">Win Rate with</th>
<th class="player">Win Rate without</th>
<th class="player">Effect with</th>
<th class="player">Effect without</th>
<th class="player">Turns</th>
<th class="player">Turns (C)</th>
</tr>
</thead>
<tbody>
$for card_name, buy_data in cards.iteritems():
<tr>
<td>$card_name</td>
$ game_denom = float(buy_data.available.frequency() or 1)
$code:
def Norm(val, digits=2):
return round(val.frequency() / game_denom, digits)
<td>$buy_data.available.frequency()</td>
<td>$Norm(buy_data.buys)</td>
<td>$Norm(buy_data.gains)</td>
<td>$(Norm(buy_data.any_gained, 3)*100)</td>
<td>$Norm(buy_data.trashes)</td>
<td>$Norm(buy_data.returns, 3)</td>
<td>$buy_data.any_gained.render_interval()</td>
<td>$buy_data.none_gained.render_interval()</td>
<td>$buy_data.game_length.render_interval()</td>
<td>$buy_data.game_length_colony.render_interval()</td>
$if player_data:
$ pdata = player_data[card_name]
$ game_denom = float(pdata.available.frequency() or 1)
<td>$pdata.available.frequency()</td>
<td>$pdata.available.render_interval()</td>
<td>$Norm(pdata.buys)</td>
<td>$Norm(pdata.gains)</td>
<td>$(Norm(pdata.any_gained, 3)*100)</td>
<td>$Norm(pdata.trashes)</td>
<td>$Norm(pdata.returns)</td>
<td>$pdata.any_gained.render_interval()</td>
<td>$pdata.none_gained.render_interval()</td>
<td>$pdata.effect_with().render_std_devs()</td>
<td>$pdata.effect_without().render_std_devs()</td>
<td>$pdata.game_length.render_interval()</td>
<td>$pdata.game_length_colony.render_interval()</td>
</tr>
</tbody>
</table>
</div>
<script type="text/javascript">
$$(document).ready( function() {
$$('#popular').dataTable( {
"aaSorting": [[ 0, "asc" ]],
"bPaginate": false
} );
} );
</script>
</body>
</html>