-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.jl
More file actions
69 lines (57 loc) · 1.82 KB
/
main.jl
File metadata and controls
69 lines (57 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
include("structs.jl")
include("backtrack.jl")
include("sat.jl")
include("human.jl")
const DIABOLIC_WIKIPEDIA_PUZZLE = "##2..#9..
#....h6.#
52..f...#
.........
.#a5..##.
........6
#...e..3.
h..i....#
...#.2.d#"
function trySimpleSolver()
println("Diabolic Str8ts featured on Wikipedia")
# https://de.wikipedia.org/wiki/Str8ts#/media/Datei:Str8ts9x9_Very_Hard_PUZ.png
warmup = SimpleStr8ts(DIABOLIC_WIKIPEDIA_PUZZLE)
solveSimple!(warmup)
s = SimpleStr8ts(DIABOLIC_WIKIPEDIA_PUZZLE)
print(s)
@time solveSimple!(s)
println(s)
end
function trySATSolver()
println("Diabolic Str8ts featured on Wikipedia")
# https://de.wikipedia.org/wiki/Str8ts#/media/Datei:Str8ts9x9_Very_Hard_PUZ.png
warmup = SimpleStr8ts(DIABOLIC_WIKIPEDIA_PUZZLE)
solveSAT!(warmup)
s = SimpleStr8ts(DIABOLIC_WIKIPEDIA_PUZZLE)
print(s)
@time solveSAT!(s)
println(s)
end
function tryHumanSolver()
println("Diabolic Str8ts featured on Wikipedia")
# https://de.wikipedia.org/wiki/Str8ts#/media/Datei:Str8ts9x9_Very_Hard_PUZ.png
warmup = Str8ts(DIABOLIC_WIKIPEDIA_PUZZLE)
solveHuman!(warmup, verbose=false) # purpose is to exclude compilation time from time measurement
s = Str8ts(DIABOLIC_WIKIPEDIA_PUZZLE)
print(s)
moves = @time solveHuman!(s, verbose=false)
println(s)
println("Hardest move hardness: $(puzzleHardness(moves))")
end
println("Using Backtracking Solver:")
println("")
trySimpleSolver()
println("")
println("Using SAT Solver:")
println("")
trySATSolver()
println("")
println("Using Human Solver:")
println("")
tryHumanSolver()
println("")
# (c) Mia Muessig