예제 #1
0
def handle_query(challenge, solver):
    """Handle a general query challenge"""
    answers = {}
    for question in challenge.questions:
        answer = solver.answer_query(question.question)
        answers[question.tid] = answer
    submission = {'challengeId': challenge.info.cid, 'answers': answers}
    result = webhandler.post_standard_submission(submission)
    print("Mark = {}%".format(result.mark))
예제 #2
0
def handle_rpn(challenge, rpn_evaluator):
    """Handle an RPN challenge"""
    answers = {}
    for question in challenge.questions:
        answer = rpn_evaluator.evaluate_rpn(question.question)
        answers[question.tid] = answer
    submission = {'challengeId': challenge.info.cid, 'answers': answers}
    result = webhandler.post_standard_submission(submission)
    print("Mark = {}%".format(result.mark))