Quote (Minkomonster @ Mar 14 2014 11:44pm)
And you aren't given the Start and End, you have to find them yourself?
The start and End were part of the GUI class, but for the purpose of the Solver i used the positions:
Start position [0][1]
Finish position [9][8] in array
Here's an example of an array that I used for my testing, and it prints the Solution in an array.
I hard-coded the array, but in actuality that would be similar to what the user would input as their own maze using the gui
Code
public static void main(String[] args) {
Solver s1 = new Solver();
String[][] map = {
{ "W", "S", "W", "W", "W", "W", "W", "W", "W", "" , "W"},
{ "W", "", "W", "", "", "", "", "", "", "" , "W"},
{ "W", "", "W", "", "W", "W", "W", "W", "W", "", "W" },
{ "W", "", "W", "", "W", "", "W", "W", "W", "" , "W"},
{ "W", "", "W", "", "W", "W", "", "W", "W", "", "W" },
{ "W", "", "W", "", "W", "", "", "W", "W", "" , "W"},
{ "W", "", "W", "", "", "", "W", "W", "W", "" , "W"},
{ "W", "", "W", "", "W", "W", "W", "W", "W", "" , "W"},
{ "W", "", "", "", "W", "", "", "", "W", "" , "W"},
{ "W", "W", "W", "W", "W", "W", "W", "W", "W", "F" , "W"} };
for (int i = 0; i < s1.solve(map).length; i++) {
for (int j = 0; j < s1.solve(map)[0].length; j++) {
System.out.printf("%3s", s1.solve(map)[i][j]);
}
System.out.println();
}
}
This post was edited by pwnage007 on Mar 15 2014 12:58am