# Summon some soldiers, then direct them to your base.
# Each soldier costs 20 gold.
while hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
soldiers = hero.findFriends()
soldierIndex = 0
# Add a while loop to command all the soldiers.
while True:
soldier = soldiers[soldierIndex]
hero.command(soldier, "move", {"x": 50, "y": 40})
# Go join your comrades!
hero.moveXY(51, 41)
Yeah this is what you writed so soldier its doing everything ok.
If you want to beat this level you should remember that soldierIndex = 0
So you are telling your soldier[0] to move
Meanwhile you want to tell every single one them to move so you shouldnt tell the command only to the soldier[0].
You should tell soldier[1],soldier[2] etc. aswell to move
Remember that soldier[1] = soldier[soldierIndex] but when the soldierIndex its set to 1
So basicly you should add +1 to soldierIndex at the end of the Loop so it will change the value of soldierIndex.
I hope i explained it right. If you have any question feel free to ask.
while soldierIndex< len(soldiers) and don`t forget to increment soldierIndex.
You have to limit it to number of your soldiers either you gonna give infinite number of orders and your hero will never move on. You can use example from @juraj_pechac
Im on phone right now, and i cant zoom it. But i think you have while true somewhere which loops it and doesnt let proceed the code. Look for while true.
When you find it just delete it
That its pretty smart honestly xD
But i dont think that was the purpose of this level. You should done that the tradition way so you will understand in next levels how to operate arrays
Well i would love too but unfortunately i didnt bought yet the premium content so im not the right person to help you with that Level. If you have problem with that you can always skip it and comeback to it later.
Well im only like 1 week ahead of you(60 levels ahead). Just try to do every level by yourself and you will catch up. And remember to dont give up Also i recommend watching https://www.twitch.tv/communities/GameDevelopment The people in chats answer every question that you might have (Not about codecombat just about coding at all).