JavaRanch » Java Forums »
Java »
Beginning Java
| Author |
Infinite Loop in my code.
|
Vincent Mule
Greenhorn
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: 44
|
|
After each step, you don't change coordinates, why?
I think it is a root of the issue.
|
 |
Vincent Mule
Greenhorn
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.
|
 |
 |
|
|
subject: Infinite Loop in my code.
|
|
|
|