# I need help with mad Maxer: redemption

**URL:** <https://discourse.codecombat.com/t/i-need-help-with-mad-maxer-redemption/27904>\
**Category:** Level Help\
**Created:** [March 12, 2021, 2:51pm UTC](https://discourse.codecombat.com/t/i-need-help-with-mad-maxer-redemption/27904 "2021-03-12T14:51:21Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vincent\_Mainer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/vincent_mainer/32/13005_2.png) [@Vincent\_Mainer](https://discourse.codecombat.com/u/Vincent_Mainer)\
**Post date:** [March 12, 2021, 2:51pm UTC](https://discourse.codecombat.com/t/i-need-help-with-mad-maxer-redemption/27904/1 "2021-03-12T14:51:22Z")

</div>

I cant beat mad maxer redemption I just cant get it I keep on getting infinite loops, have something wrong with my code, or the hero just stands there

```python
while True:
    weakestFriend = None
    leastHealth = 9999
    friendIndex = 0
    # Find which friend has the lowest health.
    friends = hero.findFriends()
    while friendIndex > len(friends):
        friend = friends(friendIndex)
        if friend:
            if friend.health < leastHealth and friend.type != "archer":
                leastHealth = weakestFriend
                weakestFriend = friend
                friendIndex += 1
    # Tell the weakest friends to go home first.
    if weakestFriend:
        hero.say('Hey ' + weakestFriend.id + ', go home!')

```

---

<div class="post-metadata">

**Author:** ![Rachel699](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rachel699/32/13569_2.png) [@Rachel699](https://discourse.codecombat.com/u/Rachel699)\
**Post date:** [March 12, 2021, 3:16pm UTC](https://discourse.codecombat.com/t/i-need-help-with-mad-maxer-redemption/27904/2 "2021-03-12T15:16:21Z")

</div>

> [@Vincent\_Mainer](#):
>
> `('Hey ' + weakestFriend.id + ', go home!')`

Try replacing the `'`(apostrophes) s with `"`(quotation/speech marks).

---

<div class="post-metadata">

**Author:** ![Vincent\_Mainer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/vincent_mainer/32/13005_2.png) [@Vincent\_Mainer](https://discourse.codecombat.com/u/Vincent_Mainer)\
**Post date:** [March 12, 2021, 3:25pm UTC](https://discourse.codecombat.com/t/i-need-help-with-mad-maxer-redemption/27904/3 "2021-03-12T15:25:59Z")

</div>

sorry it didn’t work my hero just sat around

---

<div class="post-metadata">

**Author:** ![Rachel699](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rachel699/32/13569_2.png) [@Rachel699](https://discourse.codecombat.com/u/Rachel699)\
**Post date:** [March 12, 2021, 3:30pm UTC](https://discourse.codecombat.com/t/i-need-help-with-mad-maxer-redemption/27904/4 "2021-03-12T15:30:25Z")

</div>

Can you send a screenshot of your hero’s equipment? Thanks 🙂

---

<div class="post-metadata">

**Author:** ![JoPro\_8000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jopro_8000/32/27121_2.png) [@JoPro\_8000](https://discourse.codecombat.com/u/JoPro_8000)\
**Post date:** [March 12, 2021, 4:03pm UTC](https://discourse.codecombat.com/t/i-need-help-with-mad-maxer-redemption/27904/5 "2021-03-12T16:03:22Z")

</div>

@Rachel699 I dont think that is the problem. @Vincent_Mainer said his hero was just standing still

---

<div class="post-metadata">

**Author:** ![JoPro\_8000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jopro_8000/32/27121_2.png) [@JoPro\_8000](https://discourse.codecombat.com/u/JoPro_8000)\
**Post date:** [March 12, 2021, 4:03pm UTC](https://discourse.codecombat.com/t/i-need-help-with-mad-maxer-redemption/27904/6 "2021-03-12T16:03:55Z")

</div>

I would advise looking at the hints. They help a lot in this level

---

<div class="post-metadata">

**Author:** ![jka2706](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jka2706/32/13636_2.png) [@jka2706](https://discourse.codecombat.com/u/jka2706)\
**Post date:** [March 12, 2021, 6:56pm UTC](https://discourse.codecombat.com/t/i-need-help-with-mad-maxer-redemption/27904/7 "2021-03-12T18:56:52Z")

</div>

Hi Vincent\_Mainer,

Firstly, have a look at this line:

```python
while friendIndex > len(friends):

```

You’ve set friendIndex at 0 to start, and there are 4 friends. Will this ever be true?

Also this line:

```python
                friendIndex += 1

```

needs to run _every_ time the ‘while friendIndex’ loop runs. At the moment it only runs if both the if statements are true. What do you change to make this happen?

Post again if you need more help.

Jenny

---

<div class="post-metadata">

**Author:** ![Vincent\_Mainer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/vincent_mainer/32/13005_2.png) [@Vincent\_Mainer](https://discourse.codecombat.com/u/Vincent_Mainer)\
**Post date:** [March 14, 2021, 2:36pm UTC](https://discourse.codecombat.com/t/i-need-help-with-mad-maxer-redemption/27904/8 "2021-03-14T14:36:59Z")

</div>

I have tried everything you guys said to do but a villager just dies on the sixth line, it gets stuck on defining the friends and the weakest villager dies

```python
while True:
    weakestFriend = None
    leastHealth = 9999
    friendIndex = 0
    # Find which friend has the lowest health.
    friends = hero.findFriends()
    while friendIndex < len(friends):
        friend = (friendIndex)
        if friend:
            if friend.health < leastHealth and friend.type != "archer":
                if friend.Health < leastHealth:
                    leastHealth = friend.health
        friendIndex += 1
    # Tell the weakest friends to go home first.
    if weakestFriend:
        hero.say("Hey " + weakestFriend.id + ", go home!")

```

---

<div class="post-metadata">

**Author:** ![Anonym](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anonym/32/47546_2.png) [@Anonym](https://discourse.codecombat.com/u/Anonym)\
**Post date:** [March 14, 2021, 3:16pm UTC](https://discourse.codecombat.com/t/i-need-help-with-mad-maxer-redemption/27904/9 "2021-03-14T15:16:43Z")

</div>

Hi, @Vincent_Mainer, could you send me a link to this level please?

---

<div class="post-metadata">

**Author:** ![jka2706](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jka2706/32/13636_2.png) [@jka2706](https://discourse.codecombat.com/u/jka2706)\
**Post date:** [March 14, 2021, 3:42pm UTC](https://discourse.codecombat.com/t/i-need-help-with-mad-maxer-redemption/27904/10 "2021-03-14T15:42:51Z")

</div>

@Anonym, you can find a level by putting in [CodeCombat - Coding games to learn Python and JavaScript](http://codecombat.com/play/level/)_name_, replacing name with the name of the level (spaces go in as dashes). Eg [CodeCombat - Coding games to learn Python and JavaScript](http://codecombat.com/play/level/mad-maxer-redemption)

@Vincent_Mainer, you’ve changed these lines. Put them back to what they were before!

> [@Vincent\_Mainer](#):
>
> ```python
> if friend.Health < leastHealth:
> leastHealth = friend.health
> 
> ```

Jenny

---

<div class="post-metadata">

**Author:** ![Anonym](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anonym/32/47546_2.png) [@Anonym](https://discourse.codecombat.com/u/Anonym)\
**Post date:** [March 14, 2021, 3:50pm UTC](https://discourse.codecombat.com/t/i-need-help-with-mad-maxer-redemption/27904/11 "2021-03-14T15:50:01Z")

</div>

Thanks, @jka2706!Now I won’t need to ask for the link.I see, you better help yourself, as I’m bad helper)
