I'm writing an algorithm that solves a maze, and I have a maze called char [] [] maze. Its elements be like;
{1,1,1,1,1,1, ..},
{1,0,1,0,1,1, ..},
{1,0,0,1,0,1, ..}, ...
There are 13 Rows and 17 Columns. I have to solve it using the chunk data structure. According to the algorithm I have set up in my mind, I need to store the index values of the navigable path in this stack. For example according to the above maze:
0,0
0,1
0,2
0,3
0,4
1,4
1,5
2,5...
I used to keep an integer number in my previous examples, so I used a structure like this when implementing stack construction.
public class Stack {
int topOfStack;
int capacity;
int[] Stack;
public Stack(int capacity) {
this.capacity = capacity;
Stack = new int[capacity];
topOfStack = -1;
}
void push(int element)
{
if(topOfStack == capacity){
System.out.println("Stack Overflow...");
}
else{
topOfStack++;
Stack[topOfStack] = element;
}
}
}
My question is exactly this. How can I modify this stack structure for my maze solver program? If I need to state it again, I have to keep coordinates or something similar in stack, not integers. Thanks a lot.