Kithard Brawl - Advanced Python Feature Parsing


#1

I am trying to complete the level Kithard Brawl. The goal of the challenge is to survive for 40s. Since I came back to this level and have much better gear I decide to use a simple battle code:
loop:
enemy = self.findNearestEnemy()
if enemy:
if ready = self.isReady(“cleave”):
self.cleave(enemy)
else:
self.attack(enemy)
However when I attempted to run the same code that I use on many levels I get this error message:
Fix Your Code

Possibly a bug with advanced Python feature Parsing

unknown expression type: Variable Declation


#2

The problem is this line:

if ready = self.isReady("cleave"):

It is doing an assignment inside a conditional statement, which is not currently supported in CodeCombat (and completely unnecessary in your particular case). Remove the ready = part and it should work:

if self.isReady("cleave"):

#3

Oh thank you. I was only looking at the only variable I thought I was using (the enemy variable). I actually get that bug a lot and now I know why. There must be an error with the autofiller because that’s what I use to write the code.


#4

Oh, that seems odd. I just tried the autocomplete, and it seems to work fine.

Note that the autocomplete works differently when you are inside a conditional statement. That is, if you use the “isReady” autocomplete outside of an if statement then it expands to ready = self.isReady("cleave"), but if you type if and immediately after it use the “isReady” autocomplete it will expand to self.isReady("cleave"), without the assignment part.