Esempio n. 1
0
def create_new_sudoku():
    sudoku = Sudoku()
    valor = False

    conteo_buenas = 0
    conteo_malas = 0

    ini_time = default_timer()
    end_time = 0

    while not valor:
        sus = principal_algorithm(sudoku)
        valor = sudoku.validate_grid(sus)

    #----------------------------------------------------
    # for i in range(1000):
    #     sus = generate_new_sudoku(sudoku)
    #     valor = sudoku.validate_grid(sus)
    #     if valor:
    #         conteo_buenas += 1
    #     else:
    #         conteo_malas += 1
    #----------------------------------------------------
    end_time = default_timer()
    print(end_time - ini_time, "/", conteo_buenas, "/", conteo_malas)
    return sus
Esempio n. 2
0
    end_time = default_timer()
    print(end_time - ini_time, "/", conteo_buenas, "/", conteo_malas)
    return sus


# Principal main
if __name__ == "__main__":
    sudoku = Sudoku()
    valor = False

    conteo_buenas = 0
    conteo_malas = 0

    ini_time = default_timer()
    end_time = 0

    # while not valor:
    #     sus = principal_algorithm(sudoku)
    #     valor = sudoku.validate_grid(sus)

    # ----------------------------------------------------
    for i in range(1000):
        sus = principal_algorithm(sudoku)
        valor = sudoku.validate_grid(sus)
        if valor:
            conteo_buenas += 1
        else:
            conteo_malas += 1
    # ----------------------------------------------------
    end_time = default_timer()
    print(end_time - ini_time, "/", conteo_buenas, "/", conteo_malas)