예제 #1
0
def main():
    """
    The main driver.
    """
    # File checking
    if len(sys.argv) < 2 or len(sys.argv) > 2:
        print_usage()

    # Run the front-end, davis-putnam, and back-end
    fe.front_end(sys.argv[1])
    dp.davis_putnam()
    be.back_end()

    return
예제 #2
0
def solve(n):
    clauses = all_clauses(n)
    solution = davis_putnam(clauses, set())
    if solution != set([frozenset()]):
        print_board(solution, n)
    else:
        print("The problem is not solvable for $n$ queens!")
        print("Try to increase the number of queens.")
예제 #3
0
def solve(n):
    clauses = all_clauses(n)
    solution = davis_putnam(clauses, set())
    if solution != set([frozenset()]):
        print_board(solution, n)
    else:
        print("The problem is not solvable for $n$ queens!")
        print("Try to increase the number of queens.")
예제 #4
0
def solve(n):
    clauses = all_clauses(n)
    print(clauses)
    solution = davis_putnam(clauses, Set())
    if solution != Set(Set()):
        print_board(solution, n)
    else:
        print("The problem is not solvable for %s queens!" % str(n))
        print("Try to increase the number of queens.")