for player in replay.players: races.append(player.play_race) matchup = "v".join(race[0] for race in sorted(races)) return matchup if __name__ == "__main__": data = [] replays = glob.glob("all_replays/**/*.SC2Replay", recursive=True) for filename in replays: replay = sc2reader.load_replay( filename, engine=sc2reader.engine.GameEngine(plugins=[ APMTracker(), SelectionTracker(), ContextLoader(), GameHeartNormalizer(), ])) #game['matchup'] = replay.matchup for human in replay.players: game = {} game['length'] = replay.frames / 22.4 game['map'] = replay.map_name game['matchup'] = classify_matchup(replay) game['name'] = human.name game['race'] = human.play_race game['players'] = str(replay.players) game['buildings'] = {} game['buildings']['stargates'] = [] for unit in human.units:
""" File: explore.py Author: Jacob Vartuli-Schonberg Email: [email protected] Github: https://github.com/OpenJ92 Description: """ from os import listdir from random import sample import sc2reader from sc2reader import load_replay from sc2reader.engine.plugins import APMTracker, SelectionTracker sc2reader.engine.register_plugin(APMTracker()) sc2reader.engine.register_plugin(SelectionTracker()) from Explore.objects import Objects from Explore.events import Events from Explore.datapack import Data_Pack from Explore.active_units import Active_Units from Explore.tracker_events import Tracker_Events class Explore(object): """Docstring for Explore. """ def __init__(self, directory, cls, samples=25, load_level=4): """TODO: to be defined. :directory: TODO :samples: TODO :load_level: TODO """
def get_plugins(cls): return [ContextLoader(), APMTracker(), SelectionTracker()]