Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • if(map[y][x+1]<map[y][x-1]&&map[y][x+1]<map[y+1][x]&&map[y][x+1]<map[y-1][x]&&y-1>=0&&y+1<=5&&x-1>=0&&x+1<=5) That looks pretty wrong to me. Do you actually know what this line of code is supposed to do? I sure don't, and I'd delete it and start over. Commented May 6, 2016 at 17:01
  • 1
    did you try stepping through the code with a debugger? Commented May 6, 2016 at 17:04
  • Your loop is gone into infinite loops somewhere -- you are probably not meeting any of the conditions in the if-statements -- try to singlestep the program using a debugger and see what is wrong. Commented May 6, 2016 at 17:05
  • maybe trying to refactor your code a little bit will help. Also, what is the program supposed to output? be more explicit... Commented May 6, 2016 at 17:05
  • The object should choose the next coordinate that contains the smallest value. What if there are more than 2 small values? Commented May 6, 2016 at 17:08