-
Notifications
You must be signed in to change notification settings - Fork 0
/
scores.py
executable file
·388 lines (328 loc) · 12.1 KB
/
scores.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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
#!/usr/bin/env python
# vim: set expandtab tabstop=4 shiftwidth=4:
class SongType(object):
def __init__(self, desc, win, modifier, lose, noguess):
self.desc = desc
self.win = win
self.modifier = modifier
self.lose = lose
self.noguess = noguess
class SongTypes(object):
vocal_never = SongType('Never Been Played Vocal', 150, 0, -50, -25)
vocal = SongType('Vocal', 100, 0, -50, -25)
instcover = SongType('Instrumental/Cover', 150, 0, -75, -10)
not_witt = SongType('NOT WITT', 50, 0, -100, 0)
al_phm = SongType('Full PHM Album', 1000, 0, -500, 0)
al_tds = SongType('Full TDS Album', 500, 0, -250, 0)
al_fragile_left = SongType('Full Fragile (left) Album', 1500, 0, -750, 0)
al_fragile_right = SongType('Full Fragile (right) Album', 2000, 0, -1000, 0)
class Song(object):
def __init__(self, name, songtype, real=True, album_songs=[]):
self.name = name
self.songtype = songtype
self.real = real
self.album = (len(album_songs) > 0)
self.album_songs = set(album_songs)
self.in_album = None
for album_song in self.album_songs:
album_song.in_album = self
def __lt__(self, other):
"""
Sorting!
"""
if self.album == other.album:
return self.name < other.name
else:
return other.album
class Songs(object):
# PHM Songs
dii = Song('Down In It', SongTypes.vocal)
want_to = Song('Kinda I Want To', SongTypes.vocal)
what_i_get = Song("That's What I Get", SongTypes.vocal)
only_time = Song('The Only Time', SongTypes.vocal)
ringfinger = Song('Ringfinger', SongTypes.vocal)
# This is technically a cover, but given the frequency with which
# NIN used to perform it, I'm going to count it as an "ordinary"
# vocal track, rather than a cover.
get_down_make_love = Song('Get Down, Make Love', SongTypes.vocal)
# TDS Songs
heresy = Song('Heresy', SongTypes.vocal)
ruiner = Song('Ruiner', SongTypes.vocal)
bmwag = Song('Big Man With a Gun', SongTypes.vocal)
tds = Song('The Downward Spiral', SongTypes.vocal)
# Fragile (left) Songs
witt = Song("We're In This Together", SongTypes.vocal)
not_witt = Song("NOT We're In This Together", SongTypes.not_witt, real=False)
fragile = Song('The Fragile', SongTypes.vocal)
jlyi = Song('Just Like You Imagined', SongTypes.instcover)
pilgrimage = Song('Pilgrimage', SongTypes.instcover)
no_you_dont = Song("No, You Don't", SongTypes.vocal)
great_below = Song('The Great Below', SongTypes.vocal)
# Fragile (right) Songs
way_out_is_through = Song('The Way Out is Through', SongTypes.vocal)
itv = Song('Into the Void', SongTypes.vocal)
where_is_everybody = Song('Where Is Everybody?', SongTypes.vocal_never)
mark_made = Song('The Mark Has Been Made', SongTypes.instcover)
please = Song('Please', SongTypes.vocal)
complication = Song('Complication', SongTypes.instcover)
joining_you = Song("I'm Looking Forward to Joining You, Finally", SongTypes.vocal_never)
underneath = Song('Underneath It All', SongTypes.vocal_never)
ripe = Song('Ripe (with or without Decay)', SongTypes.instcover)
# Fragile (other) Songs
leaving_hope = Song('Leaving Hope', SongTypes.instcover)
adrift_and_at_peace = Song('Adrift And At Peace', SongTypes.instcover)
deep = Song('Deep', SongTypes.vocal)
# With Teeth Songs
ediets = Song('Every Day Is Exactly The Same', SongTypes.vocal)
sunspots = Song('Sunspots', SongTypes.vocal_never)
rwib = Song('Right Where It Belongs', SongTypes.vocal)
# Year Zero Songs
capital_g = Song('Capital G', SongTypes.vocal)
violent_heart = Song('My Violent Heart', SongTypes.vocal_never)
warning = Song('The Warning', SongTypes.vocal)
god_given = Song('God Given', SongTypes.vocal)
zero_sum = Song('Zero-Sum', SongTypes.vocal_never)
twilight = Song('In This Twilight', SongTypes.vocal)
# Slip Songs
four_of_us = Song('The Four of Us Are Dying', SongTypes.instcover)
# Hesitation Marks Songs
disappointed = Song('Disappointed', SongTypes.vocal)
everything = Song('Everything', SongTypes.vocal_never)
# Trilogy Songs
not_anymore = Song('Not Anymore', SongTypes.vocal_never)
idea_of_you = Song('The Idea of You', SongTypes.vocal_never)
# Others
tetsuo = Song('Theme For Tetsuo: The Bullet Man', SongTypes.instcover)
quake = Song('Quake Main Theme (track 1)', SongTypes.instcover)
# Covers
scary_monsters = Song('Scary Monsters', SongTypes.instcover)
zoo_station = Song('Zoo Station', SongTypes.instcover)
drowning = Song('A Drowning', SongTypes.instcover)
welcomeoblivion = Song('Welcome Oblivion', SongTypes.instcover)
wing = Song('On the Wing', SongTypes.instcover)
ice_age = Song('Ice Age', SongTypes.instcover)
bbb = Song('BBB', SongTypes.instcover)
# Full Albums
al_phm = Song('Full PHM Album', SongTypes.al_phm, album_songs=[
dii,
want_to,
what_i_get,
only_time,
ringfinger,
])
al_tds = Song('Full TDS Album', SongTypes.al_tds, album_songs=[
heresy,
ruiner,
bmwag,
tds,
])
al_fragile_left = Song('Full Fragile (left) Album', SongTypes.al_fragile_left, album_songs=[
witt,
fragile,
jlyi,
pilgrimage,
no_you_dont,
great_below,
])
al_fragile_right = Song('Full Fragile (right) Album', SongTypes.al_fragile_right, album_songs=[
way_out_is_through,
itv,
where_is_everybody,
mark_made,
please,
complication,
joining_you,
underneath,
ripe,
])
class Voter(object):
def __init__(self, name, votes, offset=0, bonus_points=0):
self.name = name
self.votes = set(votes)
self.offset = offset
self.bonus_points = bonus_points
self._score = None
self.details = []
def score(self, played=None):
if self._score is None:
# First add any bonus points
if self.bonus_points > 0:
self.details.append('{:+d} bonus points for being cheeky'.format(self.bonus_points))
points = self.bonus_points
# Now go through the votes to see if they matched or not
for vote in sorted(self.votes):
if vote in played or (vote.in_album and vote.in_album in played):
point_change = max(0, (vote.songtype.win + (self.offset * vote.songtype.modifier)))
self.details.append('{:+d} for guessing "{}" correctly'.format(point_change, vote.name))
points += point_change
else:
self.details.append('{:+d} for incorrectly guessing "{}"'.format(vote.songtype.lose, vote.name))
points += vote.songtype.lose
# Now loop through the played songs to see what was potentially
# missed.
correctly_guessed = 0
total_real = 0
for song in sorted(played):
if song.real:
total_real += 1
if song in self.votes:
correctly_guessed += 1
elif song.songtype.noguess != 0:
self.details.append('{:+d} for not guessing "{}"'.format(song.songtype.noguess, song.name))
points += song.songtype.noguess
# See if the voter correctly guessed all of the debuted songs.
# If it weren't for `not_witt`, we could use boolean
# operators on the relevant `set` objects here, rather than the
# hacky counts.
if total_real > 0 and correctly_guessed == total_real:
self.details.append('+100 for guessing all debuted songs')
points += 100
# Now set our internal score var
self._score = points
return self._score
# Voters
voters = [
Voter('elevenism', [
Songs.scary_monsters,
Songs.witt,
Songs.not_anymore,
Songs.al_phm,
], bonus_points=2),
Voter('klyrish', [
Songs.witt,
Songs.itv,
Songs.heresy,
Songs.ruiner,
]),
Voter('paul_guyet', [
Songs.al_tds,
Songs.heresy,
Songs.ruiner,
Songs.tds,
Songs.fragile,
Songs.where_is_everybody,
]),
Voter('henryeatscereal', [
Songs.leaving_hope,
Songs.adrift_and_at_peace,
]),
Voter('loopcloses', [
Songs.tds,
]),
Voter('R-Dot-Yung', [
Songs.deep,
]),
Voter('K-Rice', [
Songs.al_fragile_left,
Songs.al_fragile_right,
]),
Voter('Haysey', [
Songs.itv,
Songs.idea_of_you,
Songs.leaving_hope,
Songs.tetsuo,
Songs.capital_g,
]),
Voter('joplinpicasso', [
Songs.sunspots,
Songs.witt,
]),
Voter('fillow', [
Songs.al_fragile_left,
]),
Voter('AThousandDaysBefore', [
Songs.violent_heart,
Songs.where_is_everybody,
Songs.al_fragile_left,
Songs.zoo_station,
]),
Voter('Esperanzan', [
Songs.great_below,
Songs.dii,
Songs.fragile,
Songs.heresy,
Songs.four_of_us,
Songs.not_anymore,
Songs.not_witt,
]),
Voter('xolotl', [
Songs.heresy,
Songs.itv,
Songs.warning,
Songs.disappointed,
]),
Voter('trollmanen', [
Songs.witt,
Songs.no_you_dont,
Songs.please,
Songs.deep,
Songs.quake,
]),
Voter('Elrickooo', [
Songs.underneath,
Songs.please,
Songs.ruiner,
Songs.get_down_make_love,
Songs.rwib,
Songs.god_given,
]),
Voter('Dryalex12', [
], bonus_points=2),
Voter('theimage13', [
], bonus_points=2),
# Missed 1 show
Voter('Halo Infinity', [
Songs.everything,
Songs.ediets,
], offset=1),
Voter('Deepvoid', [
Songs.idea_of_you,
Songs.leaving_hope,
Songs.witt,
], offset=1),
# Missed 2 shows
Voter('WorzelG', [
Songs.violent_heart,
Songs.zero_sum,
], offset=2),
# Missed 7 shows
Voter('cdm', [
Songs.heresy,
], offset=7),
# Missed a bunch of shoews
Voter('Erneuert', [
Songs.al_tds,
Songs.heresy,
], offset=15),
]
# What new songs have been played so far
played = set([
Songs.not_witt,
Songs.drowning,
Songs.welcomeoblivion,
Songs.jlyi,
Songs.wing,
Songs.twilight,
Songs.ice_age,
Songs.bbb,
])
# Calculate scores and report. Due to some internal Python behavior,
# this is breaking ties by the order in which the voters appear in
# the list, which is what we want. So I'm not actually specifying
# that manually.
for voter in sorted(voters, key=lambda v: v.score(played), reverse=True):
# Thus far nobody's actually taken the "no debuts" vote, and since
# I'm not subtracting points otherwise, don't bother reporting on this.
if False and voter.offset > 0:
if voter.offset == 1:
plural = ''
else:
plural = 's'
print('{}: [b]{}[/b] [i](missed {} show{})[/i]'.format(voter.name, voter.score(), voter.offset, plural))
else:
print('{}: [b]{}[/b]'.format(voter.name, voter.score()))
if len(voter.details) > 0:
print('[list]')
for detail in voter.details:
print('[*] {}'.format(detail))
print('[/list]')