I need help on Librarian tactician

I need help on this level, this is the code I did:

Soldiers spread out in a circle and defend.

def commandSoldier(soldier, soldierIndex, numSoldiers):
angle = Math.PI * 2 * soldierIndex / numSoldiers
defendPos = {“x”: 41, “y”: 40}
defendPos.x += 10 * Math.cos(angle)
defendPos.y += 10 * Math.sin(angle)
self.command(soldier, “defend”, defendPos);

This function returns something! When you call the function, you will get some value back.

def findStrongestTarget():
mostHealth = 0
bestTarget = None
enemies = self.findEnemies()
# Figure out which enemy has the most health, and set bestTarget to be that enemy.
self.buildXY(“archer”, self.pos.x, self.pos.y)
self.buildXY(“archer”, self.pos.x, self.pos.y)
# Only focus archers’ fire if there is a big ogre.
if bestTarget and bestTarget.health > 15:
return bestTarget
else:
return None

If the strongestTarget has more than 15 health, attack that target. Otherwise, attack the nearest target.

def commandArcher(archer):
if archerTarget:
self.command(archer, “attack”, archerTarget)
elif nearest:
self.command(archer, “attack”, nearest)

archerTarget = None

loop:
# If archerTarget is dead or doesn’t exist, find a new one.
if not archerTarget or archerTarget.health <= 0:
# Set archerTarget to be the target that is returned by findStrongestTarget()
archerTarget = findStrongestTarget()

``````friends = self.findFriends()
soldiers = self.findByType("soldier")

for i, soldier in enumerate(soldiers):
commandSoldier(soldier, i, len(soldiers));

# use commandArcher() to command your archers
``````

so yeah, it sucks alot doe’snt it?

you dont have to make multiple posts on the same problem