def solve_a_puzzle(puz_file, component_list_path,mode=1,limit=300,score_adjust=20):
    print puz_file
    all_output,comps_eval = components_eval.run_all_components(puz_file, component_list_path, False)
    print "TESTING JFAN" 
    print "ALL OUTPUT"
    print all_output
    print "COMPS EVAL"
    print comps_eval
    print " ____________________"
    p = puzzle.Puzzle(puz_file)
    print p.get_initial_state()
    print p.get_all_clues()
    print p.get_grid()
    solver_evaluation,solution = solver.solve_puzzle(p,all_output,mode,limit,score_adjust)
    return p.get_side_by_side_comparison(), solver_evaluation, comps_eval, solution
Exemplo n.º 2
0
def solve_a_puzzle(puz_file, component_list_path,mode=1,limit=300,score_adjust=20, n=1, second_round=True):
    print puz_file
    picklefile = 'cache/' + puz_file.replace('.', '').replace('/', '') + '.dat'
    try:
        all_output, comps_eval = pickle.load(open(picklefile))
    except IOError:
        # doesn't exist
        all_output,comps_eval = components_eval.run_all_components(puz_file, component_list_path, False)
        pickle.dump((all_output, comps_eval), open(picklefile, 'w'))

    print "####################### finished component ####################### "
    
    p = puzzle.Puzzle(puz_file)
    print p.get_initial_state()
    print p.get_all_clues()
    print p.get_grid()
    solver_evaluation,solution = solver.solve_puzzle(p,all_output,mode,limit,score_adjust, n=n, second_round=second_round)
    return p.get_side_by_side_comparison(), solver_evaluation, comps_eval, solution
Exemplo n.º 3
0
def solve_a_puzzle(puz_file, component_list_path,mode=1,limit=300,score_adjust=20):

    start = time.time()
    print puz_file

    #get all candidate words
    all_output,comps_eval = components_eval.run_all_components(puz_file, component_list_path, False)
    #all_output,comps_eval = components_eval_multi.run_all_components(puz_file, component_list_path, False)

    p = puzzle.Puzzle(puz_file)

    print p.get_initial_state()
    print p.get_all_clues()
    print p.get_grid()

    solver_evaluation,solution = solver.solve_puzzle(p,all_output,mode,limit,score_adjust)

    end = time.time()
    print "Overall time: ", end-start 
    return p.get_side_by_side_comparison(), solver_evaluation, comps_eval, solution