Mad Maxer: Redemption (Bug? for javascript)


#1

Hello. I’m wondering if there is a known bug in Mad Maxer: Redemption. I read all the hints, watched the video, which is in python, I’m using JavaScript but should work the same. My code seems to work except friend doesn’t seem to “go home”, then never leave when my hero says their name. Any help would be appreciated.

// You can’t reach your friends to defend them!
// Tell them to go home where the archer can help.
while (true) {
var weakestFriend = null;
var leastHealth = 9999;
var friendIndex = 0;
var friends = hero.findFriends();
// Find which friend has the lowest health.
while (friendIndex < friends.length) {
var friend = friends[friendIndex];
if (friend.health < leastHealth) {
leastHealth = friend.health;
weakestFriend = friend;
}
friendIndex++;
}
// Tell the weakest friends to go home first.
if (weakestFriend) {
hero.say("Hey " + weakestFriend.id + “, go home!”);
}
}

Thanks!


#2

This is not a bug. This probably is something that you are doing wrong.


#3

I’m not good enough with JS to help you, but maybe @Hellenar will respond.