[SOLVED] Desert Level - Sarven Shepherd


Hi there, from yesterday i am trying to beat “Sarven Shepherd (Desert)” and when i put the follow code :

# https://codecombat.com/play/level/sarven-shepherd?
# Usa el bucle "while" para elegir al ogro
while True:
    Enemigos = hero.findEnemies()
    IndiceDeEnemigos = 0
# Envuelve este bucle logicamente en "while" para atacar a todos los enemigos
# Encuentra la cantidad en el arreglo con:  len(Enemigos)
    while IndiceDeEnemigos < len(Enemigos):
        Enemigo = Enemigos[IndiceDeEnemigos]
	# "!=" significa "no es igual a."
	if Enemigo.type != "sand-yak":
            # Mientras la vida del enemigo sea mayor a 0, atacalo!
            while (Enemigo.health > 0)
        IndiceDeEnemigos += 1
	# Entre oleadas, regresa al centro
	hero.moveXY(40, 32)

the warrior never attack the ogres. in the level “Bank-Raid” had a similar Bug. but in that case, i just change “hero.attack” by “hero.isReady(“cleave”) and hero.cleave(Enemigo)” and works. but in this level, cleave don’t work neither.


My bad writing code xD, my solution was :

(Solution removed)


It’s great that you were able to complete this but please do not post finished code or solutions here. The purpose of this board is to help people learn and simply providing solutions is counterproductive toward that goal. Thanks.


Ok, i am sorry xD about that