Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

About the "Cloudrip Commander"?

#1

Hi,Could anyone give me hints or tips about the code?

while self.gold > self.costOf("soldier"):
self.summon("soldier")
soldiers = self.findFriends()
soldierIndex = 0
soldier = soldiers[soldierIndex]
self.command(soldier, "move", {"x": 50, "y": 40})

I tried many ways but I could not common another one to move.
If anyone could give me some hints…Thank you very much!

Thanks for bmmtstb and J_F_B_M , I passed the point.
Other players can check 2 pints “Shine Getter” and “Sarven Shepherd” in the Desert. The way is similar to these points.

#2

first of all, while u dont change soldierIndex u always command soldiers[0]… use a while for increasing limit of soldierIndex
second… i think you had been explained to use “for” loops. that means for soldier in soldiers: do sth

#3

Hui, you have already been told how to present your code properly. While using the quote-feature is creative, it is not the right way. If you don’t remember what I wrote you, please read the FAQ.


As bmmtstb already mentioned, you never increase soldierIndex. Not only that, but you always set it explicitly to 0. Move the soldierIndex = 0 in front of the while and do soldierIndex += 1 at the end of your while.

#4

Thank you for the correction.
I has read it again,I need to use triple backticks.
I will try my codes again…thank you!

#5

Thank you for the tips.
I will try it today.
Thank you very much.

1 Like