File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Infinite Loop in my code. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Infinite Loop in my code." Watch "Infinite Loop in my code." New topic

Infinite Loop in my code.

Vincent Mule

Joined: Oct 04, 2012
Posts: 14
If you saw my earlier post, we have to navigate a 10x10 array using 1's as a path. When a 1 is selected, we have to change the current position to -1 so that way we don't keep retracing our steps. When I run the program, it keeps saying STEPPED TO [2,3] over and over again. Can someone please identify where my infinite loop is? I can't seem to find it.

Ivan Franko
Ranch Hand

Joined: May 30, 2011
Posts: 46
After each step, you don't change coordinates, why?

I think it is a root of the issue.
Vincent Mule

Joined: Oct 04, 2012
Posts: 14
So I changed it to read

The changes in X and Y are reflected through the rest of the code, but I am still getting an infinite loop when attempting to move diagonally. It keeps jumping back and forth between spaces.
I agree. Here's the link:
subject: Infinite Loop in my code.
It's not a secret anymore!