# Hunters and Prey serious bug

**URL:** <https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635>\
**Category:** Solved\
**Created:** [January 29, 2016, 11:27pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635 "2016-01-29T23:27:14Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/nick/32/784_2.png) [@nick](https://discourse.codecombat.com/u/nick)\
**Post date:** [February 8, 2016, 11:25pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/21 "2016-02-08T23:25:33Z")

</div>

I switched you to Python for that level.

---

<div class="post-metadata">

**Author:** ![Thelightside](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@Thelightside](https://discourse.codecombat.com/u/Thelightside)\
**Post date:** [February 8, 2016, 11:27pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/22 "2016-02-08T23:27:05Z")

</div>

Oh thank u so much!!!

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://discourse.codecombat.com/u/Doom)\
**Post date:** [March 12, 2016, 12:54am UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/23 "2016-03-12T00:54:59Z")

</div>

It says commandArcher isn’t identified on 2 to bottom line  
here’s my code  
please help

```python
# Ogres are trying to kill your reindeer!
# Keep your archers back while summoning soldiers to attack.
def pickUpCoin():
    # Collect coins.
    items = self.findItems()
    nearestCoin = self.findNearest(items)
    if nearestCoin:
        self.move(nearestCoin.pos)
    pass
def summonTroops():
    # Summon soldiers if you have the gold.
    if self.costOf("soldier")<self.gold:
        self.summon("soldier")
        pass
# This function has an argument named soldier.
# Arguments are like variables.
# The value of an argument is determined when the function is called.
def commandSoldier(soldier):
    # Soldiers should attack enemies.
    for soldier in self.findFriends():
        enemy = soldier.findNearestEnemy()
        if enemy:
            self.command(soldier, "attack", enemy)
    pass
# Write a commandArcher function to tell your archers what to do!
# It should take one argument that will represent the archer passed to the function when it's called.
# Archers should only attack enemies who are closer than 25 meters, otherwise, stay still.
def commandarcher(archer):
    enemy = archer.findNearest(archer.findenemies)
    if enemy and archer.distanceto(enemy) < 25:
        self.command(archer, "attack", enemy)
    else:
        self.command(archer, "move", archer.pos)
loop:
    pickUpCoin()
    summonTroops()
    friends = self.findFriends()
    for friend in friends:
        if friend.type == "soldier":
            # This friend will be assigned to the variable soldier in commandSoldier
            commandSoldier(friend)
        elif friend.type == "archer":
            #commandArcher(friend)
            commandArcher(friend)
            pass

```

---

<div class="post-metadata">

**Author:** ![Thelightside](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@Thelightside](https://discourse.codecombat.com/u/Thelightside)\
**Post date:** [March 12, 2016, 8:57pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/24 "2016-03-12T20:57:27Z")

</div>

First of all before anything @Doom U must format your code according to the FAQ!!  
Put 3 backticks before and after the the code, like so:

```python

```

code

```python

```

FYI: I forgot to put the backticks at the end because it is not working.  
Here is a link to the FAQ if u need it:

> [@FAQ - Check Before Posting](https://discourse.codecombat.com/t/faq-check-before-posting/1027):
>
> Check This Awesome FAQ Before Posting … you know it’s sweet stuff! Might save your life some day. [I need help with my code!](#code-help) Check each level’s help guide for common tips If a level is too hard, try a different hero or different items Common error messages and how to debug them Post your code with radiant, harmonious formatting Personal coding help from the CodeCombat staff [The game is not working!](#not-working) It crashes It doesn’t load It’s slow The graphics aren’t showing up [Can you please fix …](#bugs)

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://discourse.codecombat.com/u/Doom)\
**Post date:** [March 13, 2016, 6:22pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/25 "2016-03-13T18:22:39Z")

</div>

how am I supposed to do that please

---

<div class="post-metadata">

**Author:** ![Thelightside](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@Thelightside](https://discourse.codecombat.com/u/Thelightside)\
**Post date:** [March 13, 2016, 6:37pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/26 "2016-03-13T18:37:32Z")

</div>

Like I said @Doom you have to put 3 backticks before and after your code and backticks are these:

```python

```

```python

```

```python

```

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://discourse.codecombat.com/u/Doom)\
**Post date:** [March 13, 2016, 7:20pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/27 "2016-03-13T19:20:52Z")

</div>

```python
Keep your archers back while summoning soldiers to attack.
def pickUpCoin():
# Collect coins.
items = self.findItems()
nearestCoin = self.findNearest(items)
if nearestCoin:
self.move(nearestCoin.pos)
pass
def summonTroops():
# Summon soldiers if you have the gold.
if self.costOf("soldier") self.summon("soldier")
pass

This function has an argument named soldier.
Arguments are like variables.
The value of an argument is determined when the function is called.
def commandSoldier(soldier):
# Soldiers should attack enemies.
for soldier in self.findFriends():
enemy = soldier.findNearestEnemy()
if enemy:
self.command(soldier, "attack", enemy)
pass

Write a commandArcher function to tell your archers what to do!
It should take one argument that will represent the archer passed to the function when it's called.
Archers should only attack enemies who are closer than 25 meters, otherwise, stay still.
def commandarcher(archer):
enemy = archer.findNearest(archer.findenemies)
if enemy and archer.distanceto(enemy) < 25:
self.command(archer, "attack", enemy)
else:
self.command(archer, "move", archer.pos)
loop:
pickUpCoin()
summonTroops()
friends = self.findFriends()
for friend in friends:
if friend.type == "soldier":
# This friend will be assigned to the variable soldier in commandSoldier
commandSoldier(friend)
elif friend.type == "archer":
#commandArcher(friend)
commandArcher(friend)
pass

```

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://discourse.codecombat.com/u/Doom)\
**Post date:** [March 13, 2016, 7:24pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/28 "2016-03-13T19:24:07Z")

</div>

This is the best i can do

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://discourse.codecombat.com/u/Doom)\
**Post date:** [March 13, 2016, 7:26pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/29 "2016-03-13T19:26:42Z")

</div>

Also I will fail if i don’t get this problem solved…When I do levels that if I lose i submit in a day…It says wait a month and I’ve been waiting for 4 months

```
                                             PLEASE HELP
```

---

<div class="post-metadata">

**Author:** ![UltCombo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ultcombo/32/3822_2.png) [@UltCombo](https://discourse.codecombat.com/u/UltCombo)\
**Post date:** [March 13, 2016, 8:47pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/30 "2016-03-13T20:47:28Z")

</div>

> [@Doom](#):
>
> When I do levels that if I lose i submit in a day…It says wait a month and I’ve been waiting for 4 months

Note that the levels that you have to wait a day between each submission are not required to progress in the main campaign. In any case, it looks like you are experiencing a quite odd bug, does it really say to wait a month? Can you post a screenshot? Is your computer’s system clock adjusted correctly? Perhaps @nick can take a look at your account’s data to check if it hasn’t been corrupted.

As for your code, please try to copy it from the game’s text editor and paste it inside ``` here. The code you’ve posted above is missing indentation.

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://discourse.codecombat.com/u/Doom)\
**Post date:** [March 13, 2016, 8:55pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/31 "2016-03-13T20:55:35Z")

</div>

how do I do that?And please notify nick about the bug  
THANK YOU

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://discourse.codecombat.com/u/Doom)\
**Post date:** [March 13, 2016, 8:57pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/32 "2016-03-13T20:57:09Z")

</div>

And I already did ```

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://discourse.codecombat.com/u/Doom)\
**Post date:** [March 13, 2016, 8:57pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/33 "2016-03-13T20:57:44Z")

</div>

I meant ```PleaseHelp

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://discourse.codecombat.com/u/Doom)\
**Post date:** [March 13, 2016, 8:59pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/34 "2016-03-13T20:59:23Z")

</div>

NM  
I made a mistake

Can You Help?

---

<div class="post-metadata">

**Author:** ![UltCombo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ultcombo/32/3822_2.png) [@UltCombo](https://discourse.codecombat.com/u/UltCombo)\
**Post date:** [March 13, 2016, 9:00pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/35 "2016-03-13T21:00:38Z")

</div>

> [@Doom](#):
>
> how do I do that?

You mean, the system clock? It depends on your computer’s operating system. There is usually a clock in a corner of your screen, you can click in the clock one or two times and it should display a calendar. Check if the calendar is displaying the correct date.

> [@Doom](#):
>
> And please notify nick about the bug

I already @-mentioned him here, so he should be able to see this thread when he has time. 😉

> [@Doom](#):
>
> I made a mistake
> 
> Can You Help?

If you say what you need help with, I may be able to help. 😃

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://discourse.codecombat.com/u/Doom)\
**Post date:** [March 13, 2016, 9:01pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/36 "2016-03-13T21:01:48Z")

</div>

With my code and the bug!

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://discourse.codecombat.com/u/Doom)\
**Post date:** [March 13, 2016, 9:03pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/37 "2016-03-13T21:03:25Z")

</div>

And There’s no clock

---

<div class="post-metadata">

**Author:** ![UltCombo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ultcombo/32/3822_2.png) [@UltCombo](https://discourse.codecombat.com/u/UltCombo)\
**Post date:** [March 13, 2016, 9:05pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/38 "2016-03-13T21:05:46Z")

</div>

For the bug, all I can do is tell you to check your machine’s system clock. If it is actually an issue with your account data, you will need one of the core guys to take a look at the CodeCombat database. Nick should be able to do that when he has time if we haven’t solved the issue until then.

As for the code, can you please try posting it again between ```? The one you have posted above is missing indentation—the spaces in the beginning of the lines—which makes it extremely hard to read.

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://discourse.codecombat.com/u/Doom)\
**Post date:** [March 13, 2016, 9:09pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/39 "2016-03-13T21:09:06Z")

</div>

```python
Keep your archers back while summoning soldiers to attack.
def pickUpCoin():
# Collect coins.
items = self.findItems()
nearestCoin = self.findNearest(items)
if nearestCoin:
self.move(nearestCoin.pos)
pass
def summonTroops():
# Summon soldiers if you have the gold.
if self.costOf("soldier") self.summon("soldier")
pass

This function has an argument named soldier.
Arguments are like variables.
The value of an argument is determined when the function is called.
def commandSoldier(soldier):
# Soldiers should attack enemies.
for soldier in self.findFriends():
enemy = soldier.findNearestEnemy()
if enemy:
self.command(soldier, "attack", enemy)
pass

Write a commandArcher function to tell your archers what to do!
It should take one argument that will represent the archer passed to the function when it's called.
Archers should only attack enemies who are closer than 25 meters, otherwise, stay still.
def commandarcher(archer):
enemy = archer.findNearest(archer.findenemies)
if enemy and archer.distanceto(enemy) < 25:
self.command(archer, "attack", enemy)
else:
self.command(archer, "move", archer.pos)
loop:
pickUpCoin()
summonTroops()
friends = self.findFriends()
for friend in friends:
if friend.type == "soldier":
# This friend will be assigned to the variable soldier in commandSoldier
commandSoldier(friend)
elif friend.type == "archer":
#commandArcher(friend)
commandArcher(friend)
pass

```

---

<div class="post-metadata">

**Author:** ![Doom](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Doom](https://discourse.codecombat.com/u/Doom)\
**Post date:** [March 13, 2016, 9:09pm UTC](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635/40 "2016-03-13T21:09:32Z")

</div>

I did it but it doesn’t show up

[Previous page](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635.md?page=1)

[Next page](https://discourse.codecombat.com/t/hunters-and-prey-serious-bug/6635.md?page=3)
