Walkthrough? i m stuck


i cant pass this level…
the game have no “help” or “walkthrough”… i m stuck on this lvl.

Try attacking if there is a nearby enemy if there is not then attack “Chest”… put it in a loop

i just bought a better armor and sword.

loop:
    self.attack("Chest")
    enemy = self.findNearestEnemy()
    if enemy:
        self.findNearestEnemy()
        self.attack(enemy)

This should work.

There’s a couple of issues with that code. First, on line 5 that second self.findNearestEnemy(), isn’t needed and it’s not actually doing anything. The main issue though is that you’re always going to alternate attacking the chest even if the enemy is alive, so it’s going to cause extra walking and ignoring the enemy attacking your backside. Try with an else clause so that you only attack the chest when there’s no enemy.

I can’t beat thorn bush farm i think its rigged when i say put fire trap the over goes the other way i need help give me the code so i can understand what this is

This thread has nothing to do with thorn bush farm. its about ogre encampment. don’t bump an unrelated thread.

how do I pass level 20 on computer science 2

Please could you make a new topic with the name of the level, you code (formatted, instructions here: How to Post Your Code With Radiant, Harmonious Formatting), and any problems you’re having. Just asking how you do it without any context isn’t very helpful.
Thanks
Danny