def worker(spells, result_q, pipes, num_runs, num_targets, time_limit, throttle): ie = ImportExport(pipes) best = [] for run in xrange(num_runs): best = find_best_cast_history( spells, num_targets, time_limit, ie.get_incoming(), throttle) ie.set_outgoing(best) result_q.put(best)
def worker(spells, result_q, pipes, num_runs, num_targets, time_limit, throttle): ie = ImportExport(pipes) best = [] incoming = [] for run in xrange(num_runs): best = find_best_cast_history( spells, num_targets, time_limit, incoming + best, throttle) incoming = ie.check_pipes() if len(best) > 0: ie.set_outgoing(best[0]) print '{} {}/{} {:,.0f} dmg {}'.format(os.getpid(), run+1, num_runs, best[0].total_damage, best[0]) sys.stdout.flush() result_q.put(best) print os.getpid(), 'exiting' sys.stdout.flush()