Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- replaypath = 'C:/Program Files (x86)/Steam/steamapps/common/Crypt of the NecroDancer/replays'
- # Store first floor replay data to remove duplicates
- firstfloors = set()
- # Death counts from 1-1 to 4-4
- deaths = [0]*16
- for filename in os.listdir(replaypath):
- namesplits = filename.split('_')
- if int(namesplits[0]) <= 75 and namesplits[9][0] == '6': # If Pre-DLC All Zones
- file = open(replaypath + '/' + filename, 'r')
- lines = file.read().split('\\n')
- file.close()
- if lines[15][0] == '7' and int(lines[11]) == 1: # If solo Coda
- firstfloor = lines[10] + lines[15] # Seed + Play data
- if firstfloor in firstfloors: continue # Filter out duplicate replays
- firstfloors.add(firstfloor)
- # Manually count number of songs played. lines[9] isn't reliable due to the stacking replay bug
- seedindex = 10
- prevseed = int(lines[seedindex])
- numsongs = 1
- seedindex += 11
- while lines[seedindex]:
- seed = int(lines[seedindex])
- if seed - prevseed not in [1, 2]: break # Stacking replay bug
- prevseed = seed
- numsongs += 1
- seedindex += 11
- deaths[numsongs - 1] += 1
- total = sum(deaths)
- print 'Total runs: %d' % total
- print
- def percent(n, d):
- if d != 0:
- return '%.1f%%' % (100. * n / d)
- else:
- return 'N/A'
- for i in range(16):
- zone = i / 4 + 1
- floor = i % 4 + 1
- visits = sum(deaths[i:])
- survives = sum(deaths[i+1:])
- print 'Deaths in %d-%d: %d\tVisited: %s\tSurvived: %s' % (zone, floor, deaths[i], percent(visits, total), percent(survives, visits))
- print
- for i in range(4):
- zone = i + 1
- zonedeaths = sum(deaths[i * 4:][:4])
- visits = sum(deaths[i * 4:])
- survives = sum(deaths[(i + 1) * 4:])
- print 'Deaths in Zone %d: %d\tVisited: %s\t Survived: %s' % (zone, zonedeaths, percent(visits, total), percent(survives, visits))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement