My goal is to take the string and place each individual character in a two dimensional array. Here is what I have so far...
The string totalMaze is:
oooooooo#S#ooooooo#oo##oooo#ooo#oo#oo$ooo######ooo oooooo
char [][] array = new char [numberOfRows][numberOfColumns];
for (int row = 0; row < numberOfRows; row++)
{
for (int col = 0; col < numberOfColumns; col++)
{
array[row][col] = totalMaze.charAt(?????????????);
}
}
I tried another for loop within the col loop, like for (int i = 0; i < totalmaze.length();i++)
the result is:
oooooooo
oooooooo
oooooooo
oooooooo
oooooooo
oooooooo
oooooooo
and I need it to be:
oooooooo
#S#ooooo
oo#oo##o
ooo#ooo#
oo#oo$oo
o######o
oooooooo
I can't figure out what to put in the charAt method to make it work! Please help, very frustrated thanks. Will post more info if needed.
ALSO...The goal of the project is to develop this maze with S as the start, o's as "roads" and #'s as "walls". $ is the end.
We need to use a recursive method to find the treasure.
I need help developing the algorithm for finding the treasure. I need to check the neighbors, but not diagonals and mark with an X if it is not the treasure so that I don't check it again. Just hard to wrap my head around