"Infinite Loop Detected" is lying and caused work to get deleted


#1

Don’t get me wrong, I like the Gridmancer challenge a lot and spend a lot of time trying to translate my plain-English algorithm into JavaScript - a language I haven’t worked too much with. There’s one issue, however.

When reloading the webpage I get an error “Infinite loop detected” and I am forced to reset and lose all my work. My loop is not infinite and has never been. Here’s an example of what is far from infinite, but will throw the error:

var boolean = true;
var something = false;
while (boolean) {
    if (something) {
        boolean = false;
        break; // Just to emphasize that we're actually quitting the loop
    } else {
        // Yadda
    }
    something = true;
}
this.say("Done!"); // This gets printed immediately

I like what you’re doing. Solve this puzzle and we’ll talk nice about you and see if we can get you a job. That’s great… but you should probably fix the critical bugs before luring real programmers to your website as opposed to spare time “script kiddies” looking for a fun and geeky game to play. We have freakier ways to solve tasks than the average w3schools teenager :wink:

Also, the Facebook login button doesn’t work (bug report: Facebook login is broken )


#2

There’s a bug with the break statement if you’re actually using it in your real code, which causes all sorts of errors - for now need to replace with extra boolean conditions on the loop (assuming that hasn’t been fixed… haven’t retested). If I’m working on anything non-trivial I’m in the habit of regularly copying it out into an external text file for backup - also helpful for keeping multiple versions of code around.

Idea: build links into the site for a javascript reference that isn’t the terrible w3schools… although trying to preempt the automatic google search is hard. Eventually I guess the goal would be building a reference into the site itself, as is starting to appear in the syntax hints… however that will take time to flesh out more fully I guess.


#3

The bug with the break statements is that the traceur transpiler (used within our transpiler) doesn’t support labeled breaks, and another component of our transpiler was turning all break statements into labeled breaks. Until I can add that support to traceur, I sort of worked around it by unlabeling all the breaks and hoping they broke to the right place (since usually people don’t actually use labeled breaks). I just added continue to my workaround, so hopefully that will also stop breaking.

However, I’m not sure this is the same bug, because the code above should work as of a few days ago, and in fact I just tried it locally and do see “Done” said immediately, with no infinite loop. Perhaps this might be a bug that I’m not seeing due to a different browser / OS combination or some such?

We were talking with a fellow from Mozilla about importing some of the Mozilla Developer Network content into the Guide tabs in our levels, since it’s open and available via API and totally great, but we haven’t moved forward on that yet.


#4

I don’t seem to get the infinite loop error anymore either… I guess you hotfixed it right after I posted the report. :stuck_out_tongue:

I did multiple tests when posting the thread, so at that point in time, it was broken.


#5

Okay, good to know! Thanks for testing that so thoroughly to get to a minimum set of problem code.


#6

i get the infinite loop error :confused: ! what should i do ??


#7

Do you get the same error? I can’t reproduce the error because my quited code doesn’t get saved at all… yes i’m logged in.


#8

Could it possibly have anything to do with network latency? https://github.com/codecombat/codecombat/issues/81

(That is, does refreshing the page after a while lead to it starting to work?)