def fetch_stats(br=None):
    if br is None:
        br = login()
    
    response = br.open("http://icfpcontest.org/icfp10/")
    
    body = response.read()
    #body = open('body').read()
    #print body
    bs = BeautifulSoup(body)

    score = bs.fetch('div', {'id': '_score_id'})[0].renderContents()
    csolved = bs.fetch('div', {'id': '_solution_id'})[0].renderContents()
    csubmitted = bs.fetch('div', {'id': '_instance_id'})[0].renderContents()
    
    return (score, csolved, csubmitted)
Beispiel #2
0
            continue

        result = solve(stream)
        if result is not None:
            print "submitting: "

            # store it temporary for debuggin
            open("temp_solution", "w").write(result)

            if testonly:
                tres = submit_test_car_fuel(stream, result)
                print tres
                if tres.find("Good!") != -1:
                    fout = open("test_data", "a")
                    fout.write(repr((car_no, result)))
                    fout.close()
            else:
                if browser is None:
                    # disabled because there is a risk of timeout
                    print "login",
                    browser = login()
                    print "ok"
                print submit_fuel(car_no, result, br=browser)

            solved += 1

        print "solved ", solved, "/ current ", total, "/ total ", len(tasks)

    print "finally solved ", solved, "/", total