# Interception HELP (SoLvEd)

**URL:** <https://discourse.codecombat.com/t/interception-help-solved/17522>\
**Category:** Level Help\
**Created:** [February 17, 2019, 3:37pm UTC](https://discourse.codecombat.com/t/interception-help-solved/17522 "2019-02-17T15:37:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naimaa1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/naimaa1/32/9542_2.png) [@Naimaa1](https://discourse.codecombat.com/u/Naimaa1)\
**Post date:** [February 17, 2019, 3:37pm UTC](https://discourse.codecombat.com/t/interception-help-solved/17522/1 "2019-02-17T15:37:09Z")

</div>

Hello, I was going back to extra levels that i never passed and I was wondering if anyone can help me with my problem.

Here’s my code:

```python
while True:
    enemy = hero.findNearestEnemy()
    friend = hero.findNearestFriend()
    # Calculate x by adding friend.pos.x to enemy.pos.x
    # Then divide by 2.
    # Check the guide if you need more help!
    x = (friend.pos.x + enemy.pos.x) / 2
    # Now do the same for y
    y = (friend.pos.y + enemy.pos.y) / 2
    # Move to the x and y coordinates you calculated.
    x = ("tower".pos.x + peasant.pos.x) / 2
    y = ("tower".pos.y + peasant.pos.y) / 2

```

Here’s a screenshot:

 ![03%20AM](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/f/f9de77521f303dc903f0504fb7faf1a3b58f12f8.jpeg)

---

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [February 17, 2019, 5:50pm UTC](https://discourse.codecombat.com/t/interception-help-solved/17522/2 "2019-02-17T17:50:14Z")

</div>

You’re pretty close. You define x and y twice. The first definitions are unnecessary, the second are close but tower is not a string and you shouldn’t be using peasant in the equation, you have defined friend above so use it there. Also, you never tell your hero to move to the x and y coordinates defined as x and y.

---

<div class="post-metadata">

**Author:** ![Naimaa1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/naimaa1/32/9542_2.png) [@Naimaa1](https://discourse.codecombat.com/u/Naimaa1)\
**Post date:** [March 2, 2019, 9:58pm UTC](https://discourse.codecombat.com/t/interception-help-solved/17522/3 "2019-03-02T21:58:21Z")

</div>

![47%20PM](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/0/08ae93a7b8cbf9fcd20c8f8c0eb44631fa9c79fb.jpeg)

I’m not sure what im supposed to fix next 😅  
can you help me please?

---

<div class="post-metadata">

**Author:** ![Chaboi\_3000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chaboi_3000/32/48486_2.png) [@Chaboi\_3000](https://discourse.codecombat.com/u/Chaboi_3000)\
**Post date:** [March 3, 2019, 6:57am UTC](https://discourse.codecombat.com/t/interception-help-solved/17522/4 "2019-03-03T06:57:20Z")

</div>

You’re adding the hero’s coordinates to your friend’s. You’re supposed to add the enemy’s coordinates to your friend’s. Then after defining x and y, you call `moveXY()` and move to the defined x and y coordinates.

---

<div class="post-metadata">

**Author:** ![Naimaa1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/naimaa1/32/9542_2.png) [@Naimaa1](https://discourse.codecombat.com/u/Naimaa1)\
**Post date:** [March 3, 2019, 11:04pm UTC](https://discourse.codecombat.com/t/interception-help-solved/17522/5 "2019-03-03T23:04:34Z")

</div>

yayyyyyy i got it, thank youuu!!! 😁😝

---

<div class="post-metadata">

**Author:** ![STEPHEN\_GRELL](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/stephen_grell/32/11375_2.png) [@STEPHEN\_GRELL](https://discourse.codecombat.com/u/STEPHEN_GRELL)\
**Post date:** [February 6, 2020, 4:42pm UTC](https://discourse.codecombat.com/t/interception-help-solved/17522/6 "2020-02-06T16:42:56Z")

</div>

I about pulled my hair out of my head trying to go back and forth from the internet and rummage for the solution…that really helped me a LOT
