Exemplo n.º 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
Exemplo n.º 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.")
Exemplo n.º 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.")
Exemplo n.º 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.")