Hello!
I got stuck at this level where I managed to kill all 3 ogres but ended up stabbed to death by spikes on the wall. I was wondering if anyone know what’s wrong with my code
while True:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
else:
hero.moveRight()
hero.moveUp()
hero.moveRight()
hero.moveDown(2)
hero.moveUp()
Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!
The maze consists of only 1 pattern, which is the same all the way to the end. You don’t need 3 hero.attack(enemy)s one is enough. The pattern is right, it’s just the if and else that are wrong.
You can do it with the if, but I did it another way.