Clash of Clones help

Help! I’m stuck on clash of clones. I’m using the bash method and simple sword. Should I get worse armor? My code is basically find enemy if enemy if ready bash then bash else attack. My shield is steel shield.

please reply!!!

Strategy and code is what matters here, not equipment. Use as little armor as possible so that your clone is easy to kill. Then use special powers, not just attack, for your hero. I used Tharin and chain lightening. Then just stand back and let the soldiers and archers do what they do best. Don’t attack sand yaks.
if enemy and enemy.type != "sand yak":

1 Like

I don’t have enough for chain lightning what else to you advise

while True:

enemyIndex = 0
enemies = self.findEnemies()
while enemyIndex < len(enemies) and self.health > self.maxHealth / 4:
    enemy = enemies[enemyIndex]
    enemyIndex += 1
    if enemy.type != 'sand-yak':
        while enemy.health > 0:
            if self.isReady("bash"):
                hero.bash(enemy)
            else:
                self.attack(enemy)
if self.health <= self.maxHealth / 4:
    enemy = enemies[enemyIndex]
    distance = self.distanceTo(enemy)
    enemyIndex += 1
    if distance > 2:
        if enemy.type != 'sand-yak':
            if self.isReady("cleave"):
                hero.cleave(enemy)
            else:
                hero.attack(enemy)

This is my code. Can you please help

never mind i passed awesome

1 Like

What did you use for equipment?

runesword, painted steel helmet, tarnished bronze breastplate, engraved wristwatch, worker’s gloves, wooden strand, thornprick, crude telephoto glasses, leather boots, programation iii, basic flags.

1 Like

here is my code i have been stuck for ages please help!
while True:
enemyIndex = 0
enemies = self.findEnemies()
while enemyIndex < len(enemies) and self.health > self.maxHealth / 4:
enemy = enemies[enemyIndex]
enemyIndex += 1
if enemy.type != ‘sand-yak’:
while enemy.health > 0:
if self.isReady(“electrocute”):
hero.electrocute(enemy)
if self.isReady(“bash”):
hero.bash(enemy)
if self.isReady(“cleave”):
hero.cleave(enemy)
else:
self.attack(enemy)
if self.health <= self.maxHealth / 4:
enemy = enemies[enemyIndex]
enemy=hero.findNearestEnemy()
distance=hero.distanceTo(enemy)
enemyIndex += 1
while enemy.health>0 :

        if distance < 4:
            if self.isReady("cleave"):
                self.cleave(enemy)
            else:
                self.attack(enemy)
        else:
            self.attack(enemy)

@starwars72015

Please learn to post ALL of your code properly. It’s really easy and only requires a very small amount of effort.

To post your code from the game, use the </> button or it won’t format properly. When you click the </> button, the following will appear:

Please paste ALL of your code inside the triple back tick marks.

``` <— Triple back tick marks.

Paste ALL of your code in here.

``` <— Triple back tick marks.

There are many people here willing and able to help. If you use the </> button correctly, then ALL of your code should look like this:

while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)
    else:
        hero.say("My code is formatted properly")

If ALL of your code isn’t formatted like the code above, then you’re doing it wrong and we can’t see the structure of the code to troubleshoot whether or not that is the issue. Use the </> button and help us help you. This works when sending a private message as well.

Thank you.

2 Likes

Yes thank you @MunkeyShynes for that legit canned post that I’ve probably seen like a billion times.

1 Like

here is my code

while True:
    enemyIndex = 0
    enemies = self.findEnemies()
    while enemyIndex < len(enemies) and self.health > self.maxHealth / 4:
        enemy = enemies[enemyIndex]
        enemyIndex += 1
        if enemy.type != 'sand-yak':
            while enemy.health > 0:
                if self.isReady("electrocute"):
                    hero.electrocute(enemy)
                if self.isReady("bash"):
                    hero.bash(enemy)
                if self.isReady("cleave"):
                    hero.cleave(enemy)
                if self.isReady("power up"):
                    self.powerUp()
                else: 
                    self.attack(enemy)
    if self.health <= self.maxHealth / 4:
        enemy = enemies[enemyIndex]
        enemy=hero.findNearestEnemy()
        distance=hero.distanceTo(enemy)
        enemyIndex += 1
        while enemy.health>0 :
            if distance < 4:
                if self.isReady("cleave"):
                    self.cleave(enemy)
                else:
                    self.attack(enemy)
            else:
                self.attack(enemy)
                

hero.moveXY(108,70)
while True:
enemy=hero.findNearestEnemy()
if enemy:
if hero.isReady(“bash”):
hero.bash(enemy)
else:
hero.attack(enemy)

1 Like

ummm do you need help or something???

Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!

1 Like