[Adventurer] Trojan Yeti


#1

Mountain level here: Trojan Yeti

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


#2

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


#3

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


#4

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


#5

Thank you! You save me with English.


#6

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


#7

Could you show your code or say your CoCo username?


#8

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):

# 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})

#9

code I added to attack:

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

#10

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


#11

Worked. Thanks!
(20 characters needed)