[SOLVED]Noble Sacrifice( Stuck on Level )

Hi everyone! I am currently stuck on the Noble Sacrifice level. I would like some help with this. When I run my code, only one of the soldiers moves to the point (90,52) while the others don’t move at all. I posted the code below. Also, I am really new to this, so I’m sorry if I did anything confusing or wrong! Thanks for your help!

# Collect 80 gold
while hero.gold <= 80:
    coin = hero.findNearestItem()
    if coin:
        hero.move(coin.pos)
soldiers = 0
while soldiers < 4:
    if hero.gold >= hero.costOf("soldier"):
        hero.summon("soldier")
        soldiers += 1
# Send your soldiers into position
points = []
points[0] = { "x": 13, "y": 73 }
points[1] = { "x": 51, "y": 73 }
points[2] = { "x": 51, "y": 53 }
points[3] = { "x": 90, "y": 52 }
friends = hero.findFriends()

# Use range to make an array to loop over.
while True:
    for j in range(len(friends)):
        point = points[j]
        friend = friends[j]
    if friend:
        hero.command(friend, "move", points)

1 Like

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

Delete the while-True-Loop otherwise you are good to go :+1:

1 Like

Oh, I didn’t see that, thanks for your help!

2 Likes

When someone solves your problem click the little checkmark next to the post that helped you. Good Luck.

2 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.