# Cloudrip Commander help plz

**URL:** <https://discourse.codecombat.com/t/cloudrip-commander-help-plz/20006>\
**Category:** Level Help\
**Created:** [January 14, 2020, 11:47am UTC](https://discourse.codecombat.com/t/cloudrip-commander-help-plz/20006 "2020-01-14T11:47:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RiceRunner](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ricerunner/32/38852_2.png) [@RiceRunner](https://discourse.codecombat.com/u/RiceRunner)\
**Post date:** [January 14, 2020, 11:47am UTC](https://discourse.codecombat.com/t/cloudrip-commander-help-plz/20006/1 "2020-01-14T11:47:49Z")

</div>

Hi, everyone!  
Just started the new ⛰ world  
Kinda stuck on this level and I don’t understand how… 🤔  
Any help at all would be very much appreciated! 😄  
Here’s my PYTHON code:

```python
# 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})
while True:
    hero.moveXY(51, 41)

```

What’s wrong with this?

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [January 14, 2020, 3:49pm UTC](https://discourse.codecombat.com/t/cloudrip-commander-help-plz/20006/2 "2020-01-14T15:49:35Z")

</div>

The problem is that you are using a while True loop. It is important to know that while True loops are actually infinite loops which don’t end unless you use break, that is why they are not as common in real coding as they are in CoCo.  
Instead you must use the kind of while loops you learned to use in the desert levels e.g.

```python
while someCounter < someNumber:
    #execute code

```

At the moment your code won’t have reached the moveXY command, but when you have fixed your code, why don’t you take it out of the loop? It will work with it in there, but it’s unnecessary, as moveXY (unlike move() which you may not have come across 🤔) doesn’t need any type of loop. It takes you there by itself.  
I hope this helps,  
Danny

---

<div class="post-metadata">

**Author:** ![RiceRunner](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ricerunner/32/38852_2.png) [@RiceRunner](https://discourse.codecombat.com/u/RiceRunner)\
**Post date:** [January 28, 2020, 11:17am UTC](https://discourse.codecombat.com/t/cloudrip-commander-help-plz/20006/3 "2020-01-28T11:17:18Z")

</div>

I have come across move()

> [@Deadpool198](#):
>
> (unlike move() which you may not have come across 🤔)

I still don’t understand what to put after while in

```python
while: #what do i put here?

```

I know it seems like im asking for an answer but I am not advanced enough to know what else to say… 😑

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [January 29, 2020, 8:21am UTC](https://discourse.codecombat.com/t/cloudrip-commander-help-plz/20006/4 "2020-01-29T08:21:02Z")

</div>

> [@RiceRunner](#):
>
> I know it seems like im asking for an answer but I am not advanced enough to know what else to say…

It’s alright, if you’re stuck go back to earlier sarven levels. I recommend “sarven saviour”, “bank raid”, “lurkers” and , if you’re a subscriber, all the mad-maxer levels.  
It’s really about how to iterate over a while loop. Remember you need an index and you need to increment it. (index += 1) And then check that it’s less than a certain no. of somethings…

---

<div class="post-metadata">

**Author:** ![RiceRunner](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ricerunner/32/38852_2.png) [@RiceRunner](https://discourse.codecombat.com/u/RiceRunner)\
**Post date:** [January 31, 2020, 9:52am UTC](https://discourse.codecombat.com/t/cloudrip-commander-help-plz/20006/5 "2020-01-31T09:52:04Z")

</div>

> [@Deadpool198](#):
>
> Remember you need an index and you need to increment it. (index += 1) And then check that it’s less than a certain no. of somethings…

Thanks for dumbing it down for me 😄  
I understand now 😆
