Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

The Final Kithmaze help


Please format your code according to the FAQ. It makes it easier to understand your code.
your are missing I think if enemy in that.


Please tell us more about whats wrong. Also post this with your code. Remember to format your code according to the FAQ.


You are finding the nearestEnemy before even moving once.

When the function is called, that is when the nearestEnemy is assigned to the variable enemy.

So instead of hero.enemy you want to do var enemy = hero.findNearestEnemy();.


the enemy=self.findnearestenemy() dont
work at alllllllllllllllllll!!!:smiling_imp:


Are you using correct capitalization and spelling? Provide an instance in which enemy = hero.findNearestEnemy() does not work.


Please do not spam with exclamation marks. It does not help us as the consultant.

You need to capitalize every new word in self.findNearestEnemy

So its find Nearest Enemy() like what I wrote above. Also, if you are using java script, you must use this.findNearestEnemy instead of self


Please do not post the working code. Even though you completed it, somebody could get it. The point of this game is to help kids to learn to code through a game, but not to just give them the code. But good job with the level!


im using lua and ive been stuck for a month


@Peter_Fisher I would help but i have no idea how to use lua. it looks complicated. Sorry :confused:


Sorry about that!!!


while True:

enemy = hero.findNearestEnemy()
if len(hero,enemy)<60:


@wartxt Please could you say a bit more about what’s happening when you run the code.


Yes as @Deadpool198 mentioned, it is hard for us to help you if you have given us little information about what is wrong. Please give info about what is happening when you run your code, any errors when you run your code, and anything else that may be useful to help us help you!:smile:



I have a question. The only error I run into with my code it the whiletrue function. It works, but I cannot figure out how to run it to where the program runs correctly. I use Python. I read the hints to try to make an understanding, but I don’t get it. It’s very infuriating, considering I went through all of the other levels leading up to this one without any trouble.


Post your code and use the </> button so I can see the error.

while True:
    enemy = hero.findNearestEnemy()


After this, my hero continues to run into the wall. Do you have any advice on how to stop him from doing this?


Well, you didn’t write any hero.moveDown(), so you will never go down.


I did the down before, and I ran into the wall also.


When I write

while True:
    enemy = hero.findNearestEnemy()

It walks backwards to the last point.