Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Infinite Loop in Sarven Savior Level - SOLVED

My problem is that in the Sarven Savior Level, I follow the instructions written, and I think my code’s OK but it always shows that there is an infinite loop detected or the code would be really slow. Also, if I get out and open it again, it shows the code of the world never finished loading and I have to start writing it again. I retried it 3 times or so, so I don’t know what to do. I am using Javascript. On the image you can see the code and the error message, but I think there isn’t any error. What should I do ?

Hm, that’s strange. You code looks good…Click the “Comment Out My Code” button. It will basically add a return; to the front of your code, so it will never run.

That is strange as you said

Could you post all of your code in a non-screenshot/text based form for us to review? Is there any code not in the 2 pictures (and are you VERY sure)?

  1. Maybe test using len(array_name) instead of using array_name.length?

  2. Test using a for loop instead – replace the while statement with

    for friendName in friendNames {

and comment out the assignment of the friendName. (Apologies, I’m not as java fluent as I’d like to be to help.)

I took a look at your code. I believe this is caused from an infinite collision loop.

Try moving the x-position of the fence left or right (29 or 31).

Thanks to everyone. I couldn’t reply the past week because I didn’t have any Internet access at all, but now I loaded again to comment my code, but apparently the bug seems solved.

Good ! :grinning::grinning::grinning::grinning::grinning::grinning: