I recently passed the level Library Tactician, but I’m still confused about the bestTarget / mostHealth part.
Can someone explain me what happens when the following code is run:
mostHealth = 0 bestTarget = None enemies = hero.findEnemies() # Figure out which enemy has the most health, and set bestTarget to be that enemy. for enemy in enemies: if enemy.health > mostHealth: mostHealth = enemy.health bestTarget = enemy
Thanks in advance!