Puzzle game solved with A* Algorithm
All the main program is built on standard java library. Only the [utest] package has a dependency on JUnit 4.12, but it is separate from the main program. You can exclude the [utest] package from the source code to compile the main program if you do not have JUnit.
solution.Main class has the main function.
Run the program as: "Main.class heuristic=value output=value input=value size=value".
heuristic : String type, set the heuristic type for A*. "distance" for the sum of the distances of the tiles from their goal positions. "misplace" for the number of misplaced tiles. It's optional, default value will be "distance".
output : String type, show each step of the puzzle solving process in the output file, the value is the name of that file. It's optional, default value will be empty then the step processing will not show out.
input : String type, set the initial state of the puzzle by user's input, type a Integer matrix in a text file. eg, 5 7 4 8 2 6 3 1 0 It's optional, default value will be random Integer matrix generated by the program. make sure your input matrix correspond to the "size" parameter.
size : Integer type, set the size of the puzzle, it = sqrt(puzzle tile number, including empty tile). eg, for 8 puzzle it's sqrt(9) = 3. It's optional, default value is 3.
You can ignore all the optional parameters or some of them. The order of parameter does not matter. eg, "Main.class" "Main.class heuristic=distance" "Main.class heuristic=distance output=step.log" "Main.class output=step.log heuristic=distance input=matrix.input" "Main.class size=4" are all valid format of running parameters.