Пример #1
0
        print(ex.cmd)
        print(ex.message)
        print(ex.returncode)
        return None


def loadWords():
    with io.open('../../data/power-words.txt') as f:
        x = f.read().split('\n')
        return list(set([s for s in x if not s.startswith('#') and s.strip()]))


if __name__ == '__main__':
    if len(sys.argv) != 5:
        print('Usage: runner.py executable tag lowIndex highIndex')
        sys.exit(1)

    executable = sys.argv[1]
    tag = sys.argv[2]
    words = loadWords()

    problems = icfp_api.filter_problems(int(sys.argv[3]), int(sys.argv[4]))
    for p in problems:
        sol_js = runProblem(executable, p, words)
        if sol_js != None:
            sol_file = '../../data/solutions/solution_%d_%s.json' % (p['id'], tag)
            for p in sol_js:
                p['tag'] = tag
            with io.open(sol_file, 'w') as h:
                h.write(json.dumps(sol_js))
Пример #2
0
    sol_file = '../../discovery.json'
    for p in sol_js:
        p['tag'] = tag
    with io.open(sol_file, 'w') as h:
        h.write(json.dumps(sol_js))
    icfp_api.send_solution(sol_file)


if __name__ == '__main__':
    if len(sys.argv) != 4:
        print('Usage: powerCheck.py executable problem_id words')
        sys.exit(1)

    executable = sys.argv[1]
    problem_id = int(sys.argv[2])
    problem = icfp_api.filter_problems(problem_id, problem_id)[0]
    words = sys.argv[3].replace('"', '\'').split(',')

    sol_js = gen_discovery_solution(executable, problem, words)
    if sol_js == None:
        sys.exit(1)

    tag = 'discovery_' + time.strftime("%H:%M:%S")
    send_discovery_solution(sol_js, tag)

    while True:
        print('waiting...')
        time.sleep(60)
        scores = rater.get_our_scores()
        if tag in scores[problem_id][3]:
            print('got score:')