hi. i’m completely confused as to what to do on this level. here is my code:
def isSubstring(word, substring):
rightEdge = len(word) - len(substring)
for i in range(rightEdge + 1):
for j in range(len(substring)):
shiftedIndex = i + j
if word[shiftedIndex] != substring[j]:
break
if j == len(substring) - 1:
return True
return False
enemies = hero.findEnemies()
for e in range(len(enemies)):
enemy = enemies[e]
if isSubstring(enemy, "bos"):
hero.attack(enemy)
To add to what @AnSeDra said, you may need to loop your attacking (until the yak is dead) unless you’ve got a sword like the rune sword with very high damage in each attack. Otherwise (as you may find out) your hero attacks the yak once, then moves on to the next, even if the previous one is still alive.
Danny
hi @AnSeDra and @Deadpool198. i beat the level. i have ritic and use the precision rifle. i accidentally hit a big yak though, while targeting a smaller one.