# Clash Of Clones Python Help Please

**URL:** <https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475>\
**Category:** Level Help\
**Created:** [May 21, 2019, 9:13pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475 "2019-05-21T21:13:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tripp](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/tripp/32/10225_2.png) [@Tripp](https://discourse.codecombat.com/u/Tripp)\
**Post date:** [May 21, 2019, 9:13pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/1 "2019-05-21T21:13:16Z")

</div>

```python
hero.moveXY(63, 68)
while True:
    enemy = hero.findNearestEnemy()
    if enemy and enemy.type != "sand-yak":
        if hero.isReady("bash"):
            hero.bash(enemy)
        elif hero.isReady("cleave") and hero.distanceTo(enemy) < 10:
            hero.cleave(enemy)
        elif hero.distanceTo(enemy) < 15:
            hero.attack(enemy)
        else:
            hero.moveXY(68, 39)
            enemy = hero.findNearestEnemy()
            if enemy and enemy.type != "sand-yak":
                if hero.isReady("bash"):
                    hero.bash(enemy)
                elif hero.isReady("cleave") and hero.distanceTo(enemy) < 10:
                    hero.cleave(enemy)
                else:
                    hero.attack(enemy)
            else:
                hero.moveXY(104, 50)
                enemy = hero.findNearestEnemy()
                if enemy and enemy.type != "sand-yak":
                    if hero.isReady("bash"):
                        hero.bash(enemy)
                    elif hero.isReady("cleave") and hero.distanceTo(enemy) < 10:
                        hero.cleave(enemy)
                    elif hero.distanceTo(enemy) < 15:
                        hero.attack(enemy)
                    else:
                       continue

```

this is my code i need help it aint working

---

<div class="post-metadata">

**Author:** ![Shurutsue](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/shurutsue/32/10314_2.png) [@Shurutsue](https://discourse.codecombat.com/u/Shurutsue)\
**Post date:** [May 21, 2019, 9:30pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/2 "2019-05-21T21:30:53Z")

</div>

Hey there! Could you elaborate on the problem?  
For example what happens when you run the code?  
When does it stop working? Or possible errors that’re shown?

EDIT:  
after testing the code myself, it seems to be working, so I’d guess the problem’s simply on how to tackle this level. If i am not mistaken I had those gloves that give access to the chain-lightning spell and used it whenever it was ready on the closest enemy.  
You could try to focus the archers first though and after that, once all your soldiers’re dead, try to kite(lure) the enemy around your archers so that the enemy hero attacks less, moves more and your archers are able to shoot at him.

There’re probably quite a lot of possibilities to tackle this level so let your imagination run free 😀  
Another idea would be to look if you can get an upgrade to your equipment (new items) that give access to more/new spells!

---

<div class="post-metadata">

**Author:** ![brooksy125](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/brooksy125/32/9966_2.png) [@brooksy125](https://discourse.codecombat.com/u/brooksy125)\
**Post date:** [May 22, 2019, 1:29pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/3 "2019-05-22T13:29:39Z")

</div>

I agree with @Shurutsue, your code is working. Below is some advice I’ve given before on this level.

> [@\[SOVED\] Help with Clash of Clones Level](https://discourse.codecombat.com/t/soved-help-with-clash-of-clones-level/18390/5):
>
> Something to think about… You don’t seem to have any special gear (rings or the emperor’s glove) that really help on this level. Regular attacks don’t quite complete this level since your enemy has the same gear and there are more enemies. Another option, is trying another hero that might have some special abilities if you have the gems to get them.

---

<div class="post-metadata">

**Author:** ![MonsterByMistake](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/monsterbymistake/32/10186_2.png) [@MonsterByMistake](https://discourse.codecombat.com/u/MonsterByMistake)\
**Post date:** [June 16, 2019, 2:56pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/4 "2019-06-16T14:56:02Z")

</div>

Bon, here’s how I did it with the dark brown lady (different heroes will need different codes):

**Use Flags**  
**Don’t Equip Strong Weapons** , the heavier you weapon the easier your boys get crushed.  
**Make your health as low as you can** so you’ll defeat the clone faster. Just avoid getting hit.  
**Kill with Chain Lightning** , you can buy a certain glove I think. This does 120 damage.

Wait for your boys to kill the rest. Wobble around avoiding the arrows. Attack right after picking up the flag.

---

<div class="post-metadata">

**Author:** ![Luke10](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/luke10/32/19892_2.png) [@Luke10](https://discourse.codecombat.com/u/Luke10)\
**Post date:** [June 16, 2019, 3:18pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/5 "2019-06-16T15:18:37Z")

</div>

Please don’t post solutions. It goes against our [community guidelines](http://discourse.codecombat.com/faq).

---

<div class="post-metadata">

**Author:** ![Shurutsue](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/shurutsue/32/10314_2.png) [@Shurutsue](https://discourse.codecombat.com/u/Shurutsue)\
**Post date:** [June 16, 2019, 3:43pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/6 "2019-06-16T15:43:52Z")

</div>

Hey Luke10! 👋  
The rules regarding **solutions** for this discourse are actually [located here](https://discourse.codecombat.com/t/welcome-to-codecombat-discourse-forums/15601), if I’m not mistaken. 😛  
Second: In case advice, or information on how one solved it himself (without actual code) is considered an **actual solution** , please also flag my post further above(or let me know so i will flag it myself), as i did more or less the same, thank you. 😅

---

<div class="post-metadata">

**Author:** ![Luke10](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/luke10/32/19892_2.png) [@Luke10](https://discourse.codecombat.com/u/Luke10)\
**Post date:** [June 16, 2019, 6:30pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/7 "2019-06-16T18:30:18Z")

</div>

Hey @Shurutsue thanks for the advice!  
I looked at the link you posted and the only mention about posting solutions that Chaboi gave was this:

“You may not post solutions. It is strongly against the rule and might result in a mute or ban”

The reason why I flagged MonsterbyMistake’s post is because he said, "This is how I did it  
Then he put:

> [@MonsterByMistake](#):
>
> **Use Flags**  
> **Don’t Equip Strong Weapons** , the heavier you weapon the easier your boys get crushed.  
> **Make your health as low as you can** so you’ll defeat the clone faster. Just avoid getting hit.  
> **Kill with Chain Lightning** , you can buy a certain glove I think. This does 120 damage.
> 
> Wait for your boys to kill the rest. Wobble around avoiding the arrows. Attack right after picking up the flag.

This is a form of a solution. He is not giving a code solution, but he is communicating on how to solve it. What I mean by how is the direct steps on how to solve this level.

I hope you don’t take any offense to this explanation and I once again commend you for your concern!!!

Edit: Also regarding your statement:

> [@Shurutsue](#):
>
> The rules regarding **solutions** for this discourse are actually [located here](https://discourse.codecombat.com/t/welcome-to-codecombat-discourse-forums/15601)

You are right

---

<div class="post-metadata">

**Author:** ![Narishm](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/narishm/32/10379_2.png) [@Narishm](https://discourse.codecombat.com/u/Narishm)\
**Post date:** [June 16, 2019, 7:17pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/8 "2019-06-16T19:17:35Z")

</div>

@MonsterByMistake’s post doesn’t strike me as a solution. He isn’t posting completed code to a challenge, they are just suggestions for completing the level. Even with those hints there are still a lot of steps that need to be taken before you can arrive at the solution.

---

<div class="post-metadata">

**Author:** ![Luke10](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/luke10/32/19892_2.png) [@Luke10](https://discourse.codecombat.com/u/Luke10)\
**Post date:** [June 16, 2019, 8:29pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/9 "2019-06-16T20:29:21Z")

</div>

That’s true… Thanks @Narishm!

@MonsterByMistake can you confirm that? I just want to make sure that isn’t a solution

---

<div class="post-metadata">

**Author:** ![Narishm](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/narishm/32/10379_2.png) [@Narishm](https://discourse.codecombat.com/u/Narishm)\
**Post date:** [June 16, 2019, 8:30pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/10 "2019-06-16T20:30:20Z")

</div>

You are welcome! 🙂

---

<div class="post-metadata">

**Author:** ![MonsterByMistake](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/monsterbymistake/32/10186_2.png) [@MonsterByMistake](https://discourse.codecombat.com/u/MonsterByMistake)\
**Post date:** [June 17, 2019, 12:43pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/11 "2019-06-17T12:43:34Z")

</div>

Bon without debating too intensely…if you believe figuring levels out is an _essential_ part of coding and no spoiler can be given, delete the post. I don’t mind at all.  
But if you think CodeCombat is just a way to help you understand code concepts, and solving puzzles aren’t important for this purpose, it makes sense to leave it here, for those who need to move on.

Cheers,

---

<div class="post-metadata">

**Author:** ![Luke10](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/luke10/32/19892_2.png) [@Luke10](https://discourse.codecombat.com/u/Luke10)\
**Post date:** [June 17, 2019, 1:26pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/12 "2019-06-17T13:26:08Z")

</div>

I think you misunderstand. Are you posting a solution or are you just giving little hints?

---

<div class="post-metadata">

**Author:** ![MonsterByMistake](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/monsterbymistake/32/10186_2.png) [@MonsterByMistake](https://discourse.codecombat.com/u/MonsterByMistake)\
**Post date:** [June 17, 2019, 4:16pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/13 "2019-06-17T16:16:54Z")

</div>

hints

[en\_US.composer.my\_button\_text]

---

<div class="post-metadata">

**Author:** ![Luke10](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/luke10/32/19892_2.png) [@Luke10](https://discourse.codecombat.com/u/Luke10)\
**Post date:** [June 17, 2019, 5:46pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/14 "2019-06-17T17:46:31Z")

</div>

Oh ok. Thanks for confirming…

---

<div class="post-metadata">

**Author:** ![hyperian](https://avatars.discourse-cdn.com/v4/letter/h/848f3c/32.png) [@hyperian](https://discourse.codecombat.com/u/hyperian)\
**Post date:** [July 2, 2019, 11:29pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/15 "2019-07-02T23:29:31Z")

</div>

This is a solution with knight. I think I found an easier way to play beat this level after many trails and errors. Trick is to equip your hero with the highest level armor and use the sword with cleave, or a low damage weapon. (maybe not even)

I find that if you prioritize your target with archers first, then scout, then ogre, then clone hero; you will soak up the damage behind the enemy line (since they always target closest). Then you proceed to still be a tank and have your archers wipe out everything else.

while the clone hero will have lots of armor, I find that since your weapon is low damage, the clone can’t hurt your side too much and will eventually die from arrows.

My solution was less than 30 lines!

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [May 20, 2020, 4:12pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/18 "2020-05-20T16:12:04Z")

</div>

OK ur banned, i found a hack and now im a moderator

jk LOL

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [May 20, 2020, 4:12pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/19 "2020-05-20T16:12:37Z")

</div>

No solutions!!!

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [May 21, 2020, 9:23am UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/20 "2020-05-21T09:23:56Z")

</div>

> [@EpicCoder999](#):
>
> OK ur banned, i found a hack and now im a moderator
> 
> jk LOL

Let’s keep it civil. And Speedypickle1 is _not_ banned, neither are you a moderator.  
Danny

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [May 21, 2020, 4:11pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/21 "2020-05-21T16:11:28Z")

</div>

can you ban people? (20)

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [May 21, 2020, 6:15pm UTC](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475/22 "2020-05-21T18:15:01Z")

</div>

No. And it’s never been used since I’ve been on the forum (that I’m aware of). Mostly it’s just limited time mutes.  
Danny

[Next page](https://discourse.codecombat.com/t/clash-of-clones-python-help-please/18475.md?page=2)
