Game's giving me an infinite loop error when I use loop { hero.shield(); }

I’m on Kithgard Brawl (round 6), with Javascript. When I use any code with hero.shield(); inside of a loop, it’s telling me to fix my code because it has an infinite loop. I know it has an infinite loop, but the code should still work as-is, since the loop is executing at least one command each time. The exact code I’m using is below, but the bug can be replicated with just hero.shield().

loop {
    if(hero.isReady("invisibility") && > 10) {
        hero.cast("invisibility", hero);

Another thing: When I use hero.shield(); inside of a loop, the health doesn’t get updated. My hero’s health is going down, but the health differences only show up about half the time. This sometimes causes the game to incorrectly give me a “SUCCESS”, but submitting my code just wastes my code turn-in for that day. I’m using the Deflector, with 3500+ health.

Please let me know if this isn’t a bug, as I’d really like to advance in this round. As of now, my hero can only survive for about 36 seconds on round 6. I can’t really work on an adequate strategy with shielding until I can get hero.shield() to work right.

Since you aren’t killing any units, and are all the way in Round 6, you probably have too many units on screen bumping into each other. If there are too many units bumping, the simulator crashes and you get a ‘code never finished’ error.

Also, when you submit, you get a random seed. So while you may succeed in the level on the current random seed, when you submit, there is a chance you’ll have different units which will cause you to lose.

1 Like