# \[Solved\]What does the duck mean?

**URL:** <https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897>\
**Category:** Level Help\
**Created:** [October 9, 2021, 7:57pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897 "2021-10-09T19:57:01Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwerty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/qwerty/32/30493_2.png) [@qwerty](https://discourse.codecombat.com/u/qwerty)\
**Post date:** [October 9, 2021, 7:57pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/1 "2021-10-09T19:57:01Z")

</div>

![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/e/0/e0484b71cb84e959658142a7b3229ea8d28bf334.png)  
my code:

```python
# You'll need good strategy to win this one!
# Your clone will have the same equipment you have!
# But, they're not very skilled at using special powers.
while True:
    enemy = hero.findNearestEnemy()
    if enemy.distance < 10:
        hero.attack(enemy)
    if hero.health < hero.maxHealth/2:
        hero.jumpTo(36,53)

```

this is where the error is:

```python
  if enemy.distance < 10:

```

thanks moon!

---

<div class="post-metadata">

**Author:** ![Anonym](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anonym/32/47546_2.png) [@Anonym](https://discourse.codecombat.com/u/Anonym)\
**Post date:** [October 9, 2021, 7:58pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/2 "2021-10-09T19:58:21Z")

</div>

Well, firstly try rewriting this line of code,

---

<div class="post-metadata">

**Author:** ![qwerty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/qwerty/32/30493_2.png) [@qwerty](https://discourse.codecombat.com/u/qwerty)\
**Post date:** [October 9, 2021, 7:58pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/3 "2021-10-09T19:58:59Z")

</div>

what line?  
(0000002)

---

<div class="post-metadata">

**Author:** ![Anonym](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anonym/32/47546_2.png) [@Anonym](https://discourse.codecombat.com/u/Anonym)\
**Post date:** [October 9, 2021, 8:00pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/4 "2021-10-09T20:00:14Z")

</div>

I gtg to sleep.Bye!sorry

---

<div class="post-metadata">

**Author:** ![qwerty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/qwerty/32/30493_2.png) [@qwerty](https://discourse.codecombat.com/u/qwerty)\
**Post date:** [October 9, 2021, 8:01pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/5 "2021-10-09T20:01:08Z")

</div>

its ok we all have to sleep.

---

<div class="post-metadata">

**Author:** ![moonwatcher348](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/moonwatcher348/32/24126_2.png) [@moonwatcher348](https://discourse.codecombat.com/u/moonwatcher348)\
**Post date:** [October 9, 2021, 8:03pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/6 "2021-10-09T20:03:53Z")

</div>

Uhhhh, it’s supposed to be `hero.distanceTo(enemy)`… I think you should have already learned this in the forest.

---

<div class="post-metadata">

**Author:** ![moonwatcher348](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/moonwatcher348/32/24126_2.png) [@moonwatcher348](https://discourse.codecombat.com/u/moonwatcher348)\
**Post date:** [October 9, 2021, 8:05pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/7 "2021-10-09T20:05:33Z")

</div>

> [@qwerty](#):
>
> `hero.jumpTo(36,53)`

And the argument needs to be a position, so like:  
Javascript:

```javascript
{x: 36, y: 53};

```

Python:

```python
{"x": 36, "y": 53}

```

---

<div class="post-metadata">

**Author:** ![qwerty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/qwerty/32/30493_2.png) [@qwerty](https://discourse.codecombat.com/u/qwerty)\
**Post date:** [October 9, 2021, 8:06pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/8 "2021-10-09T20:06:38Z")

</div>

oh ok i’ll try that  
i haven’t played in a while so i forgot

---

<div class="post-metadata">

**Author:** ![riticmaster908](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/riticmaster908/32/43503_2.png) [@riticmaster908](https://discourse.codecombat.com/u/riticmaster908)\
**Post date:** [October 9, 2021, 8:06pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/9 "2021-10-09T20:06:55Z")

</div>

or if you have vectors.

```python
Vector(36,53)

```

---

<div class="post-metadata">

**Author:** ![moonwatcher348](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/moonwatcher348/32/24126_2.png) [@moonwatcher348](https://discourse.codecombat.com/u/moonwatcher348)\
**Post date:** [October 9, 2021, 8:07pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/10 "2021-10-09T20:07:45Z")

</div>

Bruh, he isn’t even in the Mountains yet, how would he know about vectors???

---

<div class="post-metadata">

**Author:** ![riticmaster908](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/riticmaster908/32/43503_2.png) [@riticmaster908](https://discourse.codecombat.com/u/riticmaster908)\
**Post date:** [October 9, 2021, 8:08pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/11 "2021-10-09T20:08:54Z")

</div>

idk but u can do,  
while loops, for loops and if/else and while True loops with no programiticon

---

<div class="post-metadata">

**Author:** ![moonwatcher348](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/moonwatcher348/32/24126_2.png) [@moonwatcher348](https://discourse.codecombat.com/u/moonwatcher348)\
**Post date:** [October 9, 2021, 8:09pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/12 "2021-10-09T20:09:14Z")

</div>

True, but you wouldn’t be able to see how if you didn’t remember.

---

<div class="post-metadata">

**Author:** ![qwerty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/qwerty/32/30493_2.png) [@qwerty](https://discourse.codecombat.com/u/qwerty)\
**Post date:** [October 9, 2021, 8:09pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/13 "2021-10-09T20:09:27Z")

</div>

don’t get off topic.

---

<div class="post-metadata">

**Author:** ![moonwatcher348](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/moonwatcher348/32/24126_2.png) [@moonwatcher348](https://discourse.codecombat.com/u/moonwatcher348)\
**Post date:** [October 9, 2021, 8:09pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/14 "2021-10-09T20:09:53Z")

</div>

Well technically it’s not off-topic, but thats good idea.

---

<div class="post-metadata">

**Author:** ![Eric\_Tang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eric_tang/32/15310_2.png) [@Eric\_Tang](https://discourse.codecombat.com/u/Eric_Tang)\
**Post date:** [October 9, 2021, 10:08pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/15 "2021-10-09T22:08:52Z")

</div>

> [@qwerty](#):
>
> `if enemy.distance < 10:`

The problem is that you haven’t checked if the enemy exists.

---

<div class="post-metadata">

**Author:** ![Eric\_Tang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eric_tang/32/15310_2.png) [@Eric\_Tang](https://discourse.codecombat.com/u/Eric_Tang)\
**Post date:** [October 9, 2021, 10:09pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/16 "2021-10-09T22:09:01Z")

</div>

And what moonwatcher said.

---

<div class="post-metadata">

**Author:** ![qwerty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/qwerty/32/30493_2.png) [@qwerty](https://discourse.codecombat.com/u/qwerty)\
**Post date:** [October 9, 2021, 10:13pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/17 "2021-10-09T22:13:27Z")

</div>

> [@qwerty](#):
>
> `enemy = hero.findNearestEnemy()`

i did here  
(2000000)

---

<div class="post-metadata">

**Author:** ![moonwatcher348](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/moonwatcher348/32/24126_2.png) [@moonwatcher348](https://discourse.codecombat.com/u/moonwatcher348)\
**Post date:** [October 9, 2021, 10:17pm UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/18 "2021-10-09T22:17:35Z")

</div>

you still need to do `enemy && hero.distanceTo(enemy)` or `enemy and hero.distanceTo(enemy)` to check if the enemy exists or it will throw an error.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/a/a9445509d1a758c41b5ddcddc8c8e20a5dedb67f.png) [@system](https://discourse.codecombat.com/u/system)\
**Post date:** [October 10, 2021, 10:17am UTC](https://discourse.codecombat.com/t/solved-what-does-the-duck-mean/30897/19 "2021-10-10T10:17:59Z")

</div>

Closed on October 10, 2021, 10:17am UTC

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
