Esempio n. 1
0
def run_all_tests():
    log('Loading history...')
    io = HistoryIO()
    history = io.get_all_history_items()

    log("Running tests...")
    test_sufficient_data(history)
    test_tick_rate(history)

    log("================")
    log("All tests passed")
    log("================")
class FrameworkTestAgent(FlatBot):
    last_time = None

    def __init__(self, *args, **kwargs):
        self.historyIO = HistoryIO()
        self.historyIO.clear()
        self.game_tick_flat_binary = None
        super().__init__(*args, **kwargs)

    def set_flatbuffer_binary(self, game_tick_flat_binary):
        self.game_tick_flat_binary = game_tick_flat_binary

    def get_output_flatbuffer(self, game_tick_flatbuffer):
        builder = super().get_output_flatbuffer(game_tick_flatbuffer)
        self.historyIO.append(self.game_tick_flat_binary, builder.Output())
        return builder
Esempio n. 3
0
def gather_data(timeout=20.0):
    log("Gathering data...")
    HistoryIO().clear()

    # Do this synchonously, the time the process needs to startup is more consistent.
    ensure_dll_is_injected()

    proc = multiprocessing.Process(target=record_atba)
    log("Starting data gathering process...")
    proc.start()
    proc.join(timeout)
    if proc.is_alive():
        log("Stopping data gathering...")
        # TODO: Find a nicer way. maybe we should exit out of the match too
        kill_proc_tree(proc.pid)
        proc.join()
    log("Data gathering finished.")
 def __init__(self, *args, **kwargs):
     self.historyIO = HistoryIO()
     self.historyIO.clear()
     self.game_tick_flat_binary = None
     super().__init__(*args, **kwargs)