# \[Solved\] Clash of clones python

**URL:** <https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505>\
**Category:** Solved\
**Created:** [August 12, 2018, 11:17am UTC](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505 "2018-08-12T11:17:39Z")\
**Posts on this page:** 12\
**Page:** 4

<div class="post-metadata">

**Author:** ![Roboham](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/roboham/32/22883_2.png) [@Roboham](https://discourse.codecombat.com/u/Roboham)\
**Post date:** [June 10, 2021, 11:01am UTC](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505/61 "2021-06-10T11:01:28Z")

</div>

I tried shielding too, but it won’t work with my steel shield(blocks60.8, able to bashhhhhh)

---

<div class="post-metadata">

**Author:** ![Aditya\_Kulkarni\_WV](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aditya_kulkarni_wv/32/22026_2.png) [@Aditya\_Kulkarni\_WV](https://discourse.codecombat.com/u/Aditya_Kulkarni_WV)\
**Post date:** [October 20, 2021, 10:35pm UTC](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505/62 "2021-10-20T22:35:08Z")

</div>

i need help this is my code

self.moveXY(68, 78)  
back = 0  
while True:  
enemys = self.findEnemies()  
index = 0  
closest\_soldier = None  
soldier\_dist = 999  
closest\_archer = None  
archer\_dist = 999  
closest = None  
dist = 999  
while(index\<len(enemys)):  
distance = self.distanceTo(enemys[index])  
if(enemys[index].health\>0 and enemys[index].type != “sand-yak” ):  
if(enemys[index].type == ‘archer’ and distance\<archer\_dist):  
archer\_dist=distance  
closest\_archer = enemys[index]  
if(enemys[index].type == ‘soldier’ and distance\<soldier\_dist):  
soldier\_dist=distance  
closest\_soldier = enemys[index]  
if(distance\<dist):  
soldier\_dist=dist  
closest = enemys[index]  
index +=1  
if(closest\_soldier and soldier\_dist\<10):  
enemy = closest\_soldier  
elif(closest\_archer and archer\_dist\<20):  
enemy = closest\_archer  
else:  
enemy = closest  
if(enemy):  
if(self.health\<self.maxHealth/2.5 and back==0):  
self.moveXY(40, 85)  
back = 1  
elif(self.health\<self.maxHealth/5 and back==1):  
self.moveXY(40, 85)  
back = 2  
elif(self.isReady(“jump”) and self.distanceTo\>15):  
self.jumpTo(enemy.pos)  
elif(self.isReady(“bash”)):  
self.bash(enemy)  
elif(self.isReady(“power-up”)):  
self.powerUp()  
self.attack(enemy)  
elif(self.isReady(“cleave”)):  
self.cleave(enemy)  
else:  
self.attack(enemy)

---

<div class="post-metadata">

**Author:** ![Aditya\_Kulkarni\_WV](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aditya_kulkarni_wv/32/22026_2.png) [@Aditya\_Kulkarni\_WV](https://discourse.codecombat.com/u/Aditya_Kulkarni_WV)\
**Post date:** [October 20, 2021, 10:35pm UTC](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505/63 "2021-10-20T22:35:48Z")

</div>

![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/0/f/0f19f4eaa7fa476a3d854b3215a35f5e908aafba.jpeg)

---

<div class="post-metadata">

**Author:** ![Aditya\_Kulkarni\_WV](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aditya_kulkarni_wv/32/22026_2.png) [@Aditya\_Kulkarni\_WV](https://discourse.codecombat.com/u/Aditya_Kulkarni_WV)\
**Post date:** [October 20, 2021, 10:36pm UTC](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505/64 "2021-10-20T22:36:18Z")

</div>

this my gear so whats wrong

---

<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 20, 2021, 10:49pm UTC](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505/65 "2021-10-20T22:49:46Z")

</div>

> [@Aditya\_Kulkarni\_WV](#):
>
> this is my code

I found this code on github,  
Can you please make your own code and format it?

---

<div class="post-metadata">

**Author:** ![Aditya\_Kulkarni\_WV](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aditya_kulkarni_wv/32/22026_2.png) [@Aditya\_Kulkarni\_WV](https://discourse.codecombat.com/u/Aditya_Kulkarni_WV)\
**Post date:** [October 21, 2021, 1:53am UTC](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505/66 "2021-10-21T01:53:13Z")

</div>

self.moveXY(74, 69)  
self.moveXY(59, 70)  
while True:  
enemy = self.findEnemies()  
if hero.isReady(“bash”):  
hero.bash(hero.findNearestEnemy())  
else:  
self.shield()  
if self.health \< 100:  
self.moveXY(62, 69)  
break

\*\* \> Blockquote\*

---

<div class="post-metadata">

**Author:** ![Aditya\_Kulkarni\_WV](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aditya_kulkarni_wv/32/22026_2.png) [@Aditya\_Kulkarni\_WV](https://discourse.codecombat.com/u/Aditya_Kulkarni_WV)\
**Post date:** [October 21, 2021, 1:53am UTC](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505/67 "2021-10-21T01:53:33Z")

</div>

how do you format your code

---

<div class="post-metadata">

**Author:** ![Aditya\_Kulkarni\_WV](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aditya_kulkarni_wv/32/22026_2.png) [@Aditya\_Kulkarni\_WV](https://discourse.codecombat.com/u/Aditya_Kulkarni_WV)\
**Post date:** [October 21, 2021, 1:54am UTC](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505/68 "2021-10-21T01:54:02Z")

</div>

hello  
anyone here to help

---

<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 21, 2021, 2:01am UTC](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505/69 "2021-10-21T02:01:27Z")

</div>

Press  
 ![Screenshot 2021-10-20 8.01.19 PM](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/a/9/a9b12173eb4ba232c87a947a3e031a94ebc344f7.png)

---

<div class="post-metadata">

**Author:** ![Aditya\_Kulkarni\_WV](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aditya_kulkarni_wv/32/22026_2.png) [@Aditya\_Kulkarni\_WV](https://discourse.codecombat.com/u/Aditya_Kulkarni_WV)\
**Post date:** [October 21, 2021, 2:05am UTC](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505/70 "2021-10-21T02:05:12Z")

</div>

```python
self.moveXY(74, 69)
self.moveXY(59, 70)
while True:
    enemy = self.findEnemies()
    if hero.isReady("bash"):
        hero.bash(hero.findNearestEnemy())
    else:
        self.shield()
    if self.health < 100:
        self.moveXY(62, 69)
        break

```

type or paste code here

```python

```

---

<div class="post-metadata">

**Author:** ![Aditya\_Kulkarni\_WV](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aditya_kulkarni_wv/32/22026_2.png) [@Aditya\_Kulkarni\_WV](https://discourse.codecombat.com/u/Aditya_Kulkarni_WV)\
**Post date:** [October 21, 2021, 2:05am UTC](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505/71 "2021-10-21T02:05:41Z")

</div>

here you go eric tang

---

<div class="post-metadata">

**Author:** ![Aditya\_Kulkarni\_WV](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aditya_kulkarni_wv/32/22026_2.png) [@Aditya\_Kulkarni\_WV](https://discourse.codecombat.com/u/Aditya_Kulkarni_WV)\
**Post date:** [October 21, 2021, 2:13am UTC](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505/72 "2021-10-21T02:13:52Z")

</div>

hello i need help are you here

[Previous page](https://discourse.codecombat.com/t/solved-clash-of-clones-python/15505.md?page=3)
