Exemple #1
0
            best_fit = cw.fitness()
            best_cw = copy.deepcopy(cw)
            print("New best:", best_fit)
        del cw
        iters += 1
    if best_cw == None:
        print("Error: could not create a single crossword puzzle")
        exit(-1)
    print("Used words:", best_cw.get_used_words())
    print("Grid:")
    print(best_cw.get_grid())
    print("Fitness:", best_fit)

    print("TOTAL WORDS:", len(words))

    #draw(best_cw.get_grid(), best_cw.used_words, best_cw.solution_positions)

    best_cw.store_grid("intermediate_store.txt")

if EDIT_OLD:
    cw = Crossword(SIZE, SIZE)
    cw.load_grid("intermediate_store.txt")

    cw.hide_secret(loesung)

    print(cw.fitness())

    draw(cw.get_grid(), cw.used_words, cw.solution_positions, DRAW_LINES)

else:
    print("Doing nothing...")