# Help on library tactitian

**URL:** https://discourse.codecombat.com/t/help-on-library-tactitian/22533
**Category:** Level Help
**Created:** [June 25, 2020, 11:07am UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533 "2020-06-25T11:07:54Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Corgi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/corgi/32/12942_2.png) [@Corgi](https://discourse.codecombat.com/u/Corgi)
#### Post date: [June 25, 2020, 11:07am UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/1 "2020-06-25T11:07:54Z")

</div>

here is my code:  
pls help

# Hushbaum has been ambushed by ogres!

# She is busy healing her soldiers, you should command them to fight!

# The ogres will send more troops if they think they can get to Hushbaum or your archers, so keep them inside the circle!

# 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)  
hero.command(soldier, “defend”, defendPos);  
if (soldier.health \> 60):  
hero.command(soldier, “defend”, defendPos)  
else:  
hero.command(soldier, “defend”, {‘x’: 42, ‘y’: 40})

# Find the strongest target (most health)

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

def findStrongestTarget():  
mostHealth = 0  
bestTarget = None  
enemies = hero.findEnemies()  
# Figure out which enemy has the most health, and set bestTarget to be that enemy.  
# 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):  
nearest = archer.findNearestEnemy()  
if archerTarget:  
hero.command(archer, “attack”, archerTarget)  
elif nearest:  
hero.command(archer, “attack”, nearest)

archerTarget = None

while True:  
# If archerTarget is defeated 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 = hero.findFriends()
soldiers = hero.findByType("soldier")
# Create a variable containing your archers.
acherTarget = findStrongestTarget()
for i in range(len(soldiers)):
    soldier = soldiers[i]
    commandSoldier(soldier, i, len(soldiers));
hero.command(archer, "attack", archerTarget)
 # use commandArcher() to command your archers
```

---

<div class="post-metadata">

### Author: ![Corgi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/corgi/32/12942_2.png) [@Corgi](https://discourse.codecombat.com/u/Corgi)
#### Post date: [June 25, 2020, 11:08am UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/2 "2020-06-25T11:08:31Z")

</div>

```python
# Hushbaum has been ambushed by ogres!
# She is busy healing her soldiers, you should command them to fight!
# The ogres will send more troops if they think they can get to Hushbaum or your archers, so keep them inside the circle!

# 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)
    hero.command(soldier, "defend", defendPos);
    if (soldier.health > 60):
        hero.command(soldier, "defend", defendPos)
    else:
        hero.command(soldier, "defend", {'x': 42, 'y': 40})

# Find the strongest target (most health)
# This function returns something! When you call the function, you will get some value back.
def findStrongestTarget():
    mostHealth = 0
    bestTarget = None
    enemies = hero.findEnemies()
    # Figure out which enemy has the most health, and set bestTarget to be that enemy.
    # 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):
    nearest = archer.findNearestEnemy()
    if archerTarget:
        hero.command(archer, "attack", archerTarget)
    elif nearest:
        hero.command(archer, "attack", nearest)

archerTarget = None

while True:
    # If archerTarget is defeated 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 = hero.findFriends()
    soldiers = hero.findByType("soldier")
    # Create a variable containing your archers.
    acherTarget = findStrongestTarget()
    for i in range(len(soldiers)):
        soldier = soldiers[i]
        commandSoldier(soldier, i, len(soldiers));
    hero.command(archer, "attack", archerTarget)
     # use commandArcher() to command your archers
   

```

---

<div class="post-metadata">

### Author: ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)
#### Post date: [June 25, 2020, 11:15am UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/3 "2020-06-25T11:15:27Z")

</div>

Hi @Corgi and welcome to the forum! 🥳

Try to put this

> [@Corgi](#):
>
> `hero.command(archer, "attack", archerTarget)`

In a **for archer in archers** loop.  
In between those two comments

> [@Corgi](#):
>
> ```python
> # Figure out which enemy has the most health, and set bestTarget to be that enemy.
> # Only focus archers' fire if there is a big ogre.
> 
> ```

Try to make a for loop that goes through all elements from the enemies array and finds out the enemy with the most health and put it in the variabile bestTarget (as you did in the level with the big archer from the desert)  
Do you need any more assistance at this level?

---

<div class="post-metadata">

### Author: ![Corgi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/corgi/32/12942_2.png) [@Corgi](https://discourse.codecombat.com/u/Corgi)
#### Post date: [June 25, 2020, 3:15pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/4 "2020-06-25T15:15:43Z")

</div>

ok i’ve done that  
now it saying archer not difined 🤨  
 ![screenshot-codecombat.com-2020.06.25-16_14_19](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/9/9662cff46cd1c917036595b982f71008c09b93af.png)

---

<div class="post-metadata">

### Author: ![Corgi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/corgi/32/12942_2.png) [@Corgi](https://discourse.codecombat.com/u/Corgi)
#### Post date: [June 25, 2020, 3:17pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/5 "2020-06-25T15:17:38Z")

</div>

thx

[en\_US.composer.my\_button\_text]

---

<div class="post-metadata">

### Author: ![Corgi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/corgi/32/12942_2.png) [@Corgi](https://discourse.codecombat.com/u/Corgi)
#### Post date: [June 25, 2020, 3:18pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/6 "2020-06-25T15:18:09Z")

</div>

Thank you for welcoming me!

---

<div class="post-metadata">

### Author: ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)
#### Post date: [June 25, 2020, 3:18pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/7 "2020-06-25T15:18:09Z")

</div>

Can you show me your code?

---

<div class="post-metadata">

### Author: ![Corgi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/corgi/32/12942_2.png) [@Corgi](https://discourse.codecombat.com/u/Corgi)
#### Post date: [June 25, 2020, 3:20pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/8 "2020-06-25T15:20:01Z")

</div>

it is the hilighted part

```python
def commandArcher(archer):
    nearest = archer.findNearestEnemy()
    if archerTarget:
        hero.command(archer, "attack", archerTarget)
    elif nearest:
        hero.command(archer, "attack", nearest)

    archerTarget = None

```

---

<div class="post-metadata">

### Author: ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)
#### Post date: [June 25, 2020, 3:20pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/9 "2020-06-25T15:20:52Z")

</div>

That looks alright. Can you show me your whole code?

---

<div class="post-metadata">

### Author: ![Corgi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/corgi/32/12942_2.png) [@Corgi](https://discourse.codecombat.com/u/Corgi)
#### Post date: [June 25, 2020, 3:24pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/10 "2020-06-25T15:24:42Z")

</div>

```python
# Hushbaum has been ambushed by ogres!
# She is busy healing her soldiers, you should command them to fight!
# The ogres will send more troops if they think they can get to Hushbaum or your archers, so keep them inside the circle!

# 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)
    hero.command(soldier, "defend", defendPos);
    if (soldier.health > 60):
        hero.command(soldier, "defend", defendPos)
    else:
        hero.command(soldier, "defend", {'x': 42, 'y': 40})

# Find the strongest target (most health)
for archer in archers:
    # This function returns something! When you call the function, you will get some value back.
    def findStrongestTarget():
        mostHealth = 0
        bestTarget = None
        enemies = hero.findEnemies()
        # Figure out which enemy has the most health, and set bestTarget to be that enemy.
        # 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):
    nearest = archer.findNearestEnemy()
    if archerTarget:
        hero.command(archer, "attack", archerTarget)
    elif nearest:
        hero.command(archer, "attack", nearest)

    archerTarget = None

while True:
    # If archerTarget is defeated 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 = hero.findFriends()
    soldiers = hero.findByType("soldier")
    # Create a variable containing your archers.
    acherTarget = findStrongestTarget()
    for i in range(len(soldiers)):
        soldier = soldiers[i]
        commandSoldier(soldier, i, len(soldiers));
    hero.command(archer, "attack", archerTarget)
    commandArcher()
     # use commandArcher() to command your archers
   

```

---

<div class="post-metadata">

### Author: ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)
#### Post date: [June 25, 2020, 3:25pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/11 "2020-06-25T15:25:54Z")

</div>

> [@Corgi](#):
>
> ```python
> hero.command(archer, "attack", archerTarget)
> commandArcher()
> 
> ```

Here is the problem. Delete that, then loop through all the archers and put commandArcher(archer) for all of them.

---

<div class="post-metadata">

### Author: ![Corgi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/corgi/32/12942_2.png) [@Corgi](https://discourse.codecombat.com/u/Corgi)
#### Post date: [June 25, 2020, 3:26pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/12 "2020-06-25T15:26:05Z")

</div>

here is my charicter  
 ![screenshot-codecombat.com-2020.06.25-16_25_05](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/7/79e234b64b344e21b7708e0084627e1c9f08c817.png)

---

<div class="post-metadata">

### Author: ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)
#### Post date: [June 25, 2020, 3:26pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/13 "2020-06-25T15:26:26Z")

</div>

> [@AnSeDra](#):
>
> In between those two comments
> 
> > [@Corgi](#):
> >
> > ````python
> > > # Figure out which enemy has the most health, and set bestTarget to be that enemy.
> > # Only focus archers' fire if there is a big ogre.
> > > ```
> > 
> > ````
> 
> Try to make a for loop that goes through all elements from the enemies array and finds out the enemy with the most health and put it in the variabile bestTarget (as you did in the level with the big archer from the desert)

This one you did not correct.

---

<div class="post-metadata">

### Author: ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)
#### Post date: [June 25, 2020, 3:27pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/14 "2020-06-25T15:27:00Z")

</div>

If you need any more help, just send me your code.

---

<div class="post-metadata">

### Author: ![Corgi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/corgi/32/12942_2.png) [@Corgi](https://discourse.codecombat.com/u/Corgi)
#### Post date: [June 25, 2020, 3:29pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/15 "2020-06-25T15:29:34Z")

</div>

still doesn’t work ☹

```python
# Hushbaum has been ambushed by ogres!
# She is busy healing her soldiers, you should command them to fight!
# The ogres will send more troops if they think they can get to Hushbaum or your archers, so keep them inside the circle!

# 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)
    hero.command(soldier, "defend", defendPos);
    if (soldier.health > 60):
        hero.command(soldier, "defend", defendPos)
    else:
        hero.command(soldier, "defend", {'x': 42, 'y': 40})

# Find the strongest target (most health)
for archer in archers:
    # This function returns something! When you call the function, you will get some value back.
    def findStrongestTarget():
        mostHealth = 0
        bestTarget = None
        enemies = hero.findEnemies()
        # Figure out which enemy has the most health, and set bestTarget to be that enemy.
        # 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):
    nearest = archer.findNearestEnemy()
    if archerTarget:
        hero.command(archer, "attack", archerTarget)
    elif nearest:
        hero.command(archer, "attack", nearest)

    archerTarget = None

while True:
    # If archerTarget is defeated 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 = hero.findFriends()
    soldiers = hero.findByType("soldier")
    # Create a variable containing your archers.
    acherTarget = findStrongestTarget()
    for i in range(len(soldiers)):
        soldier = soldiers[i]
        commandSoldier(soldier, i, len(soldiers));# Hushbaum has been ambushed by ogres!
# She is busy healing her soldiers, you should command them to fight!
# The ogres will send more troops if they think they can get to Hushbaum or your archers, so keep them inside the circle!

# 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)
    hero.command(soldier, "defend", defendPos);
    if (soldier.health > 60):
        hero.command(soldier, "defend", defendPos)
    else:
        hero.command(soldier, "defend", {'x': 42, 'y': 40})

# Find the strongest target (most health)
for archer in archers:
    # This function returns something! When you call the function, you will get some value back.
    def findStrongestTarget():
        mostHealth = 0
        bestTarget = None
        enemies = hero.findEnemies()
        # Figure out which enemy has the most health, and set bestTarget to be that enemy.
        # Hushbaum has been ambushed by ogres!
# She is busy healing her soldiers, you should command them to fight!
# The ogres will send more troops if they think they can get to Hushbaum or your archers, so keep them inside the circle!

# 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)
    hero.command(soldier, "defend", defendPos);
    if (soldier.health > 60):
        hero.command(soldier, "defend", defendPos)
    else:
        hero.command(soldier, "defend", {'x': 42, 'y': 40})

# Find the strongest target (most health)
for archer in archers:
    # This function returns something! When you call the function, you will get some value back.
    def findStrongestTarget():
        mostHealth = 0
        bestTarget = None
        enemies = hero.findEnemies()
        # Figure out which enemy has the most health, and set bestTarget to be that enemy.
        # Hushbaum has been ambushed by ogres!
# She is busy healing her soldiers, you should command them to fight!
# The ogres will send more troops if they think they can get to Hushbaum or your archers, so keep them inside the circle!

# 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)
    hero.command(soldier, "defend", defendPos);
    if (soldier.health > 60):
        hero.command(soldier, "defend", defendPos)
    else:
        hero.command(soldier, "defend", {'x': 42, 'y': 40})

# Find the strongest target (most health)
for archer in archers:
    # This function returns something! When you call the function, you will get some value back.
    def findStrongestTarget():
        mostHealth = 0
        bestTarget = None
        enemies = hero.findEnemies()
        # Figure out which enemy has the most health, and set bestTarget to be that enemy.
        hero.command(archer, "attack", archerTarget)
        commandArcher()
        # 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):
    nearest = archer.findNearestEnemy()
    if archerTarget:
        hero.command(archer, "attack", archerTarget)
    elif nearest:
        hero.command(archer, "attack", nearest)

    archerTarget = None

while True:
    # If archerTarget is defeated 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 = hero.findFriends()
    soldiers = hero.findByType("soldier")
    # Create a variable containing your archers.
    acherTarget = findStrongestTarget()
    for i in range(len(soldiers)):
        soldier = soldiers[i]
        commandSoldier(soldier, i, len(soldiers));

     # use commandArcher() to command your archers
   

        # 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):
    nearest = archer.findNearestEnemy()
    if archerTarget:
        hero.command(archer, "attack", archerTarget)
    elif nearest:
        hero.command(archer, "attack", nearest)

    archerTarget = None

while True:
    # If archerTarget is defeated 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 = hero.findFriends()
    soldiers = hero.findByType("soldier")
    # Create a variable containing your archers.
    acherTarget = findStrongestTarget()
    for i in range(len(soldiers)):
        soldier = soldiers[i]
        commandSoldier(soldier, i, len(soldiers));
    hero.command(archer, "attack", archerTarget)
    commandArcher()
     # use commandArcher() to command your archers
   

        # 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):
    nearest = archer.findNearestEnemy()
    if archerTarget:
        hero.command(archer, "attack", archerTarget)
    elif nearest:
        hero.command(archer, "attack", nearest)

    archerTarget = None

while True:
    # If archerTarget is defeated 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 = hero.findFriends()
    soldiers = hero.findByType("soldier")
    # Create a variable containing your archers.
    acherTarget = findStrongestTarget()
    for i in range(len(soldiers)):
        soldier = soldiers[i]
        commandSoldier(soldier, i, len(soldiers));
    hero.command(archer, "attack", archerTarget)
    commandArcher()
     # use commandArcher() to command your archers
   

     # use commandArcher() to command your archers
   

```

---

<div class="post-metadata">

### Author: ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)
#### Post date: [June 25, 2020, 3:32pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/16 "2020-06-25T15:32:52Z")

</div>

> [@Corgi](#):
>
> `acherTarget = findStrongestTarget()`

Here put archerTarget instead of archerTarget. And you still did not correct what I told you to.

---

<div class="post-metadata">

### Author: ![Corgi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/corgi/32/12942_2.png) [@Corgi](https://discourse.codecombat.com/u/Corgi)
#### Post date: [June 25, 2020, 3:36pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/17 "2020-06-25T15:36:01Z")

</div>

my code was to big so i reloaded the whole thing and i might need some help getting the right code back again 😑

---

<div class="post-metadata">

### Author: ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)
#### Post date: [June 25, 2020, 3:38pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/18 "2020-06-25T15:38:49Z")

</div>

Just copy the code that you posted and then make the changes I told you to do and then you can ask again if you get any more errors.

---

<div class="post-metadata">

### Author: ![Corgi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/corgi/32/12942_2.png) [@Corgi](https://discourse.codecombat.com/u/Corgi)
#### Post date: [June 25, 2020, 3:39pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/19 "2020-06-25T15:39:56Z")

</div>

ok but i think it might have the same code in it more than what is nessersery

---

<div class="post-metadata">

### Author: ![Aloafabread](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@Aloafabread](https://discourse.codecombat.com/u/Aloafabread)
#### Post date: [April 15, 2022, 4:40pm UTC](https://discourse.codecombat.com/t/help-on-library-tactitian/22533/20 "2022-04-15T16:40:39Z")

</div>

I need help.  
I can’t get past a certain part. I have gotten to 55.1.  
this is my code

```python
# Hushbaum has been ambushed by ogres!
# She is busy healing her soldiers, you should command them to fight!
# The ogres will send more troops if they think they can get to Hushbaum or your archers, so keep them inside the circle!
# 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)
    hero.command(soldier, "defend", defendPos);

# Find the strongest target (most health)
# This function returns something! When you call the function, you will get some value back.
def findStrongestTarget():
    mostHealth = 0
    bestTarget = None
    enemies = hero.findEnemies()
    for enemy in enemies:
        if enemy.maxHealth > mostHealth:
            bestTarget = enemy
    # Figure out which enemy has the most health, and set bestTarget to be that enemy.
    # Only focus archers' fire if there is a big ogre.
    if bestTarget and bestTarget.health > 15:
        return bestTarget
    else:
        mostHealth = 0
        return None

# If the strongestTarget has more than 15 health, attack that target. Otherwise, attack the nearest target.
def commandArcher(archer):
    nearest = archer.findNearestEnemy()
    if archerTarget:
        hero.command(archer, "attack", archerTarget)
    elif nearest:
        hero.command(archer, "attack", nearest)

archerTarget = None

while True:
    # If archerTarget is defeated or doesn't exist, find a new one.
    friends = hero.findFriends()
    soldiers = hero.findByType("soldier")
    
    
    
    if not archerTarget or archerTarget.health <= 0:
        # Set archerTarget to be the target that is returned by findStrongestTarget()
        archerTarget = findStrongestTarget()
    
    
    # Create a variable containing your archers.
    archers = hero.findByType("archer")
    for i in range(len(soldiers)):
        soldier = soldiers[i]
        commandSoldier(soldier, i, len(soldiers));
    # use commandArcher() to command your archers
    for team in archers:
        commandArcher(team)

```

this is my equipment  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/0/0/00a9aebc56b4eaea567f7b9ec2063279ed2d37a7.png)

[Next page](https://discourse.codecombat.com/t/help-on-library-tactitian/22533.md?page=2)
