Loop Da Loop statement count error?


Using python for the Loop Da Loop level, I am getting an error and fail. The code is working, but it is failing because it is not under 6 statements (in fact, it is 4 statements). While I am wearing better gear than the level was intended for, this should still pass:

    gem = self.findNearest(self.findItems())
    if gem:
        self.moveXY(gem.pos.x, gem.pos.y)


Statements are not the same as lines. You actually have 8 statements.


Okay, I get what you mean there, compound vs simple statements, still the semantics are less than clear in this regard.


Also of note, when wearing upgraded boots, the gem check seems to be required, simplified movement loops have you going too fast, eventually you try to pass the laser and die.


I hope you realize that it’s the 3rd topic about the same level today, mentioning basically the same things…

Oh, and btw you can get under 6 statements if you use move instead of moveXY (and use [0] instead of self.findNearest)


Why, when I put this into a loop, is it more than 6 statements?

enemy = self.findEnemies()[0]
if enemy.target:
    self.move(Vector.subtract(Vector(40,40), enemy.target.pos))

Ok - really weird. Just went back to the level and the same code which had failed now reports success. Ugh.
And when I reloaded the level, this went back to failing the 6 statement test. Double ugh.