Solved - Can't beat Signal Corpse

I’m pretty sure that my code is fine so maybe I’m just bad at dropping flags? :frowning:

Here’s my code:

# You can use flags to choose different tactics.
# In this level, the green flag will mean you want to move to the flag.
# The black flag means you want to cleave at the flag.
# The doctor will heal you at the Red X

loop:
    green = self.findFlag("green")
    black = self.findFlag("black")
    nearest = self.findNearestEnemy()
    
if green:
        self.pickUpFlag(green)
    elif black and self.isReady("cleave"):
        self.pickUpFlag(black)
        # Cleave!
        self.cleave(nearest)
    elif nearest and self.distanceTo(nearest) < 10:
        # Attack!
        self.attack(nearest)
        pass
    else:
        self.shield()

Of course I try again and this time I’m able to beat the level. What was happening is that I was getting killed by the ogres so I had to resort to running back to the healer but then I’d run out of time to kill everyone. I finally got lucky with my flag drops!

Here is my code. I have tried numerous times to win and have upgraded armour/speed/health. I could be bad at playing the game, but I don’t think I should be prohibited from learning more coding simply because I am bad at playing the game part.

loop:
green = self.findFlag(“green”)
black = self.findFlag(“black”)
nearest = self.findNearestEnemy()

if green:
    self.pickUpFlag(green)
    
elif black and self.isReady("cleave"):    
    self.pickUpFlag(black)
    # Cleave!    
    self.cleave(nearest)
    self.shield()    

elif self.distanceTo(nearest) < 10:
    # Attack!
    self.attack(nearest)
    self.shield()
    pass

else:
    self.shield()

常常不是超时就是莫名其妙被打死
看来我不会玩游戏

often time be killed or timed out
may be I just bad for playing game

Please do not bring up dead topics

i cant kill the two big ogres and my time runs out when I get all the small ones

this is my code

while True:
    
    green = self.findFlag("green")
    black = self.findFlag("black")
    nearest = self.findNearestEnemy()
    
    if green:
        self.pickUpFlag(green)
    elif black and self.isReady("cleave"):
        self.pickUpFlag(black)
        # Cleave!
        self.cleave(nearest)
    elif nearest and self.distanceTo(nearest) < 10:
        # Attack!
        self.attack(nearest)
        pass
    else:
        self.shield()
    hero.moveXY(18, 29)


Please post your code so we can help you.

This is’t you code CodeCombat got rid of self years ago.

no i just put this in i have been using self for ever
basicly

can I get a link to this level or tell me where is is

but my guy he is doing it correctly but he cant kill the big dudes

yea i will send the link

https://codecombat.com/play/level/signal-corpse?

@logan_jordan please don’t post in topics that haven’t been posted in for a long time. It creates disorganization and goes against our guidelines.

I will create a new topic for you.

Luke it’s completely fine if it’s related to the thread. He’s asking for help on the same level. Please don’t think up rules. :slight_smile: Please refer to community rules in the welcome thread if you’re unsure about anything.

I did the same thing a while ago and the same thing was said to me as far as bringing up dead topics goes…

1 Like

hate to bring up dead topics but im on a deadline. need to pass this level and its clearly designed against anyone beating it. ive used all the codes provided and used my own multiple times. i just cant kill the big ones. please resolve this because my progress and grades depend on a resolution.