How do I complete Clash of Clones?

This code kills all of the clones, but the hero dies just before the last of ogres are killed.

while True:
    Badniks = hero.findEnemies()
    EggPawns = hero.findByType("archer", Badniks)
    SonicAndCo = hero.findFriends()
    RobotIndex = 0
    while RobotIndex < len(EggPawns):
        Badnik = EggPawns[RobotIndex]
        if hero.distanceTo(Badnik) < 37:
            while Badnik.health > 0:
                if hero.isReady("bash"):
                    hero.bash(Badnik)
                else:
                    hero.attack(Badnik)
        RobotIndex += 1
    RobotIndex = 0
    while RobotIndex < len(Badniks):
        Badnik = Badniks[RobotIndex]
        if Badnik.type != "sand-yak" and hero.distanceTo(Badnik) < 37:
            if not hero.health < 10:
                while Badnik.health > 0:
                    if hero.isReady("bash"):
                        hero.bash(Badnik)
                    else:
                        hero.attack(Badnik)
            elif len(SonicAndCo) > 6:
                hero.shield()
            else:
                while Badnik.health > 0:
                    if hero.isReady("bash"):
                        hero.bash(Badnik)
                    else:
                        hero.attack(Badnik)
        RobotIndex += 1

Yes, I’m a Sonic fan.

I only have 106 diamonds left.

Was the += and the ! supposed to be there? Also could you send a screenshot?

Is it giving you any errors in the game? You also may not have the right equipment

Try some better armor…

No seriously, I have 106 diamonds left. I can’t buy any better armor at this point.

And there are no errors.

1 Like

Pay the subscription then it should give you 2,000 gems…it’s $9.99

No, I’m not gonna pay real money for some extra currency in a game! I went on Codecombat just to enjoy coding, not to pay some bucks!

And, I have 518 diamonds now thanks to some brawl levels.

Okay, do you play with a free account?

Yes, I do play with a free account.

Your clone will have the same equipment you have!
But, they’re not very skilled at using special powers.
=> use special powers and you win

1 Like

That’s why I always have a couple thousand diamonds in my inventory. I save up to purchase the best armor in the game like the Deflector

1 Like

No need for suggestions anymore. I defeated the clone army already by moving away from the enemies when the health is low.

1 Like

Congratulations! Its a tough level!

1 Like

can you pass the code

No solutions like giving the code are allowed on the forum. Codecombat was created to teach people how to code. Please post your code with a description and we will try our best to help you

1 Like

while True:
Badniks = hero.findEnemies()
EggPawns = hero.findByType(“archer”, Badniks)
SonicAndCo = hero.findFriends()
RobotIndex = 0
while RobotIndex < len(EggPawns):
Badnik = EggPawns[RobotIndex]
if hero.distanceTo(Badnik) < 37:
while Badnik.health > 0:
if hero.isReady(“bash”):
hero.bash(Badnik)
else:
hero.attack(Badnik)
RobotIndex += 1
RobotIndex = 0
while RobotIndex < len(Badniks):
Badnik = Badniks[RobotIndex]
if Badnik.type != “sand-yak” and hero.distanceTo(Badnik) < 37:
if not hero.health < 10:
while Badnik.health > 0:
if hero.isReady(“bash”):
hero.bash(Badnik)
else:
hero.attack(Badnik)
elif len(SonicAndCo) > 6:
hero.shield()
else:
while Badnik.health > 0:
if hero.isReady(“bash”):
hero.bash(Badnik)
else:
hero.attack(Badnik)
RobotIndex += 1

can you give an example of special powers :slight_smile:

can you please give me some help

Hi, if you need help with your code, post it formatted and tell me what your problems are.
Danny