# \[Adventurer\] Trojan Yeti

**URL:** <https://discourse.codecombat.com/t/adventurer-trojan-yeti/9658>\
**Category:** Adventurer\
**Created:** [November 17, 2016, 5:58am UTC](https://discourse.codecombat.com/t/adventurer-trojan-yeti/9658 "2016-11-17T05:58:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [November 17, 2016, 5:58am UTC](https://discourse.codecombat.com/t/adventurer-trojan-yeti/9658/1 "2016-11-17T05:58:42Z")

</div>

Mountain level here: [Trojan Yeti](https://www.codecombat.com/play/level/trojan-yeti)

The second level in `trim` series. Wereyeti like time-bombs – you can wipe out your enemies, but also you can blow yourself.

---

<div class="post-metadata">

**Author:** ![Harry\_the\_Wanderer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/harry_the_wanderer/32/5369_2.png) [@Harry\_the\_Wanderer](https://discourse.codecombat.com/u/Harry_the_Wanderer)\
**Post date:** [November 20, 2016, 7:16am UTC](https://discourse.codecombat.com/t/adventurer-trojan-yeti/9658/2 "2016-11-20T07:16:08Z")

</div>

On a few of the seeds I ran out of time. The third time I submitted worked.

submitted grammar patch  
Same challenge with LUA as the other `trim()` level

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [November 20, 2016, 7:29am UTC](https://discourse.codecombat.com/t/adventurer-trojan-yeti/9658/3 "2016-11-20T07:29:21Z")

</div>

> [@Harry\_the\_Wanderer](#):
>
> On a few of the seeds I ran out of time. The third time I submitted worked.

Hm. Interesting. I tested it many times. Anyway, added 10 seconds. Thanks!

---

<div class="post-metadata">

**Author:** ![Harry\_the\_Wanderer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/harry_the_wanderer/32/5369_2.png) [@Harry\_the\_Wanderer](https://discourse.codecombat.com/u/Harry_the_Wanderer)\
**Post date:** [November 20, 2016, 7:36am UTC](https://discourse.codecombat.com/t/adventurer-trojan-yeti/9658/4 "2016-11-20T07:36:42Z")

</div>

I tried again with 4 submits and all worked this time. Looks like it is good.

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [November 21, 2016, 5:41am UTC](https://discourse.codecombat.com/t/adventurer-trojan-yeti/9658/5 "2016-11-21T05:41:39Z")

</div>

Thank you! You save me with English.

---

<div class="post-metadata">

**Author:** ![kaiduck](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@kaiduck](https://discourse.codecombat.com/u/kaiduck)\
**Post date:** [August 7, 2017, 12:09am UTC](https://discourse.codecombat.com/t/adventurer-trojan-yeti/9658/6 "2017-08-07T00:09:26Z")

</div>

The yetis keep getting killed by the ogres. What should I do?

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [August 7, 2017, 4:39am UTC](https://discourse.codecombat.com/t/adventurer-trojan-yeti/9658/7 "2017-08-07T04:39:20Z")

</div>

Could you show your code or say your CoCo username?

---

<div class="post-metadata">

**Author:** ![kaiduck](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@kaiduck](https://discourse.codecombat.com/u/kaiduck)\
**Post date:** [August 7, 2017, 11:42am UTC](https://discourse.codecombat.com/t/adventurer-trojan-yeti/9658/8 "2017-08-07T11:42:49Z")

</div>

I managed to beat the level by attacking the ogres when a little after killing the yetis. I shouldn’t have to do that. Here is my code(without attacking):

```python
# You need to defeat ogres.
# Send wereyeti peasants to the ogre camp and watch.

# This function returns a friendly unit by the name.
def findFriendByName(name):
    friends = hero.findFriends()
    for i in range(len(friends)):
        if friends[i].id == name:
            return friends[i]
    return None

# The sergeant wrote the list of wereyeti peasants' names.
sergeant = hero.findNearest(hero.findFriends())
wereList = sergeant.wereList
# The list isn't clean and contains redundant spaces. 
wereNames = wereList.split(",")

# Iterate through wereNames array:
for wereName in wereNames:
    # Trim the whitespace from the name
    # and save it in the new variable:
    wereName = wereName.trim()
    # Use findFriendByName function to find a wereyeti:
    wereYeti = findFriendByName(wereName)
    # Command that unit move to the ogre camp:
    hero.command(wereYeti, "move", {"x":48,"y":48})

```

---

<div class="post-metadata">

**Author:** ![kaiduck](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@kaiduck](https://discourse.codecombat.com/u/kaiduck)\
**Post date:** [August 7, 2017, 11:43am UTC](https://discourse.codecombat.com/t/adventurer-trojan-yeti/9658/9 "2017-08-07T11:43:30Z")

</div>

code I added to attack:

```python
hero.wait(25)
hero.moveXY(23, 46)
while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)

```

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [August 7, 2017, 11:58am UTC](https://discourse.codecombat.com/t/adventurer-trojan-yeti/9658/10 "2017-08-07T11:58:38Z")

</div>

Your code looks correct. Try to re-submit it, maybe it’s a “bad seed”

---

<div class="post-metadata">

**Author:** ![kaiduck](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@kaiduck](https://discourse.codecombat.com/u/kaiduck)\
**Post date:** [August 8, 2017, 8:50pm UTC](https://discourse.codecombat.com/t/adventurer-trojan-yeti/9658/11 "2017-08-08T20:50:20Z")

</div>

Worked. Thanks!  
(20 characters needed)
