Solution to the N-puzzle problem using A star and Iterative Deepening A star (IDA*)
Sample output:
FOUND SOLUTION!
Moves to get to the solution: Buldluldrddrulluurdrrdlldluurdlurrrddlulurulldrurrddluurddd
The solution:
6 13 7 10
8 9 11 x
15 2 12 5
14 3 1 4
=>
6 13 7 x
8 9 11 10
15 2 12 5
14 3 1 4
=>
6 13 x 7
8 9 11 10
15 2 12 5
14 3 1 4
=>
6 13 11 7
8 9 x 10
15 2 12 5
14 3 1 4
=>
6 13 11 7
8 x 9 10
15 2 12 5
14 3 1 4
=>
6 x 11 7
8 13 9 10
15 2 12 5
14 3 1 4
=>
x 6 11 7
8 13 9 10
15 2 12 5
14 3 1 4
=>
8 6 11 7
x 13 9 10
15 2 12 5
14 3 1 4
=>
8 6 11 7
13 x 9 10
15 2 12 5
14 3 1 4
=>
8 6 11 7
13 2 9 10
15 x 12 5
14 3 1 4
=>
8 6 11 7
13 2 9 10
15 3 12 5
14 x 1 4
=>
8 6 11 7
13 2 9 10
15 3 12 5
14 1 x 4
=>
8 6 11 7
13 2 9 10
15 3 x 5
14 1 12 4
=>
8 6 11 7
13 2 9 10
15 x 3 5
14 1 12 4
=>
8 6 11 7
13 2 9 10
x 15 3 5
14 1 12 4
=>
8 6 11 7
x 2 9 10
13 15 3 5
14 1 12 4
=>
x 6 11 7
8 2 9 10
13 15 3 5
14 1 12 4
=>
6 x 11 7
8 2 9 10
13 15 3 5
14 1 12 4
=>
6 2 11 7
8 x 9 10
13 15 3 5
14 1 12 4
=>
6 2 11 7
8 9 x 10
13 15 3 5
14 1 12 4
=>
6 2 11 7
8 9 10 x
13 15 3 5
14 1 12 4
=>
6 2 11 7
8 9 10 5
13 15 3 x
14 1 12 4
=>
6 2 11 7
8 9 10 5
13 15 x 3
14 1 12 4
=>
6 2 11 7
8 9 10 5
13 x 15 3
14 1 12 4
=>
6 2 11 7
8 9 10 5
13 1 15 3
14 x 12 4
=>
6 2 11 7
8 9 10 5
13 1 15 3
x 14 12 4
=>
6 2 11 7
8 9 10 5
x 1 15 3
13 14 12 4
=>
6 2 11 7
x 9 10 5
8 1 15 3
13 14 12 4
=>
6 2 11 7
9 x 10 5
8 1 15 3
13 14 12 4
=>
6 2 11 7
9 1 10 5
8 x 15 3
13 14 12 4
=>
6 2 11 7
9 1 10 5
x 8 15 3
13 14 12 4
=>
6 2 11 7
x 1 10 5
9 8 15 3
13 14 12 4
=>
6 2 11 7
1 x 10 5
9 8 15 3
13 14 12 4
=>
6 2 11 7
1 10 x 5
9 8 15 3
13 14 12 4
=>
6 2 11 7
1 10 5 x
9 8 15 3
13 14 12 4
=>
6 2 11 7
1 10 5 3
9 8 15 x
13 14 12 4
=>
6 2 11 7
1 10 5 3
9 8 15 4
13 14 12 x
=>
6 2 11 7
1 10 5 3
9 8 15 4
13 14 x 12
=>
6 2 11 7
1 10 5 3
9 8 x 4
13 14 15 12
=>
6 2 11 7
1 10 5 3
9 x 8 4
13 14 15 12
=>
6 2 11 7
1 x 5 3
9 10 8 4
13 14 15 12
=>
6 2 11 7
1 5 x 3
9 10 8 4
13 14 15 12
=>
6 2 x 7
1 5 11 3
9 10 8 4
13 14 15 12
=>
6 x 2 7
1 5 11 3
9 10 8 4
13 14 15 12
=>
x 6 2 7
1 5 11 3
9 10 8 4
13 14 15 12
=>
1 6 2 7
x 5 11 3
9 10 8 4
13 14 15 12
=>
1 6 2 7
5 x 11 3
9 10 8 4
13 14 15 12
=>
1 x 2 7
5 6 11 3
9 10 8 4
13 14 15 12
=>
1 2 x 7
5 6 11 3
9 10 8 4
13 14 15 12
=>
1 2 7 x
5 6 11 3
9 10 8 4
13 14 15 12
=>
1 2 7 3
5 6 11 x
9 10 8 4
13 14 15 12
=>
1 2 7 3
5 6 11 4
9 10 8 x
13 14 15 12
=>
1 2 7 3
5 6 11 4
9 10 x 8
13 14 15 12
=>
1 2 7 3
5 6 x 4
9 10 11 8
13 14 15 12
=>
1 2 x 3
5 6 7 4
9 10 11 8
13 14 15 12
=>
1 2 3 x
5 6 7 4
9 10 11 8
13 14 15 12
=>
1 2 3 4
5 6 7 x
9 10 11 8
13 14 15 12
=>
1 2 3 4
5 6 7 8
9 10 11 x
13 14 15 12
=>
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 x
=>
The end!