New Player Problems: What's wrong with my code for the level 'Endangered Burl'?

I started playing CodeCombat 2 days ago and thought it was a very well thought out and addictive game. I recently came to a level called ‘Endangered Burl’ and have spent at least an hour trying to complete it but nothing seems to work. At first, the character attacked both munchkins but hesitated to do so at the throwers. After a while of switching up code I found that my character wouldn’t move or attack enemies when I ran it.

Am I missing something blindingly obvious? :confused:

Merged Doublepost

Here is my code:

Loop:

enemy=self.findnearestenemy()
If enemy.type is "burl"
self.say("I am not attacking that Burl!)
If enemy.type is "munchkin" :      
Self.attack(enemy)
If enemy.type is "thrower" :    
Self.attack(enemy)
If enemy.type is "ogre" :  
Self.moveXY(41,37)

I formatted your code as mentioned in the PM, but you there are a lot of mistakes in it. I assume you retyped it for the forum? Please include the original code.


All errors I noticed:

  • All ifs are with an uppercase I.
  • The loop is uppercase as well.
  • A lot of self are uppercase.
  • Your findnearestenemy should be findNearestEnemy
  • You’re missing a " after ... attacking that Burl!
  • All your indentations are missing. Python won’t work this way.