This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I'm having trouble with my current program here. We are supposed to find a path out of a maze using a coordinate class. We have to create coordinates and then push them onto a stack. At the end we have to pop the stack to get the path coordinates. I am having problems backtracking in my while loop. I can get all the way to that but when it hits a dead end I can't figure out how to pop the stack and take the coordinates from the previous space and apply them to the loop. If anybody could help me out that would be great. I have included the coordinate class as well as some sample mazes. Thanks.
I think the problem is in this while loop (line 152)
That is a lot of code to go through and in all fairness I haven't. But I have a remark:
Do not catch ArrayIndexOutOfBoundsExceptions. Just ask the size of the array and operate in those bounds.
And if you really really really want to catch it then at least log it, otherwise you'll never know about the exception.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.