示例#1
0
def arc_consistent(puzzle):    
    state = parse_puzzle(puzzle)
    result,num_nodes = arc_consistent_helper(state)
    if result['Solved']:
        return unparse_puzzle(result),num_nodes
    else:
        None,None
示例#2
0
def forwardchecking(puzzle):
    state = parse_puzzle(puzzle)
    result, num_nodes = forwardchecking_helper(state)
    if result['Max_depth']:
        return unparse_puzzle(result), num_nodes
    else:
        None
示例#3
0
def backtracking(puzzle):
    state = parse_puzzle(puzzle)

    result, num_nodes = backtrackingHelper(state)
    if result['Solved']:
        return unparse_puzzle(result), num_nodes
    else:
        return None, None