Reindeer Wakeup Bug

# This array contains the 'asleep' or 'awake' status for each reindeer.
deerStatus = [ 'asleep', 'asleep', 'asleep', 'asleep', 'asleep' ]

# And this array contains our reindeer.
friends = hero.findFriends()

# Loop through all the reindeer and see which ones are awake.
for deerIndex in range(len(friends)):
    reindeer = friends[deerIndex]
    if reindeer.pos.y > 30:
        deerStatus[deerIndex] = "awake"
    # If the reindeer's Y position is greater than 30, it's out of its pen.
    # If this is the case, set the reindeer's entry in the deerStatus array to 'awake'.
# Loop through statuses and report to Merek.
for statusIndex in range(len(deerStatus)):
    # Tell Merek the reindeer index and whether it's asleep or awake.
    # Say something like "Reindeer 2 is asleep" or "Reindeer 4 is awake"
#    if deerStatus[statusIndex] == "asleep":
        speech = "Reindeer " + statusIndex + " is " + deerStatus[statusIndex]


Could you describe a problem more careful?



I execute my code properly, and it goes through each stall, telling the NPC which reindeer are asleep, and which are awake. The npc wakes the reindeer up, as they are supposed to, but the level still times out for me. Please see the attached screenshot.


Yes, I got the same. Thanks. We will fix it ASAP.


This should now be fixed. Let us know if those reindeer give you any more trouble!


I’ve got this bug in Safari, but in Firefox everything works good!


‘Overview’ body

var a = [ null, “one”, “two” ];
hero.say(a[1]); // Says "one"
hero.say(a[2]); // Says "two"
hero.say(a[0]); // Says nothing
hero.say(a[3]); // Error! Array starts at 0 and ends at 2.


It errors because you have no “3”. The computer starts counting at 0 so a 3 to the computer is basically a 4 to us. For example, 0 is null. 1 is “one”, and 2 is “two”. a[0] says nothing because you passed null.


Error is here:
hero.say(a[0]); // Says nothing is not correct


Because you set 0 to null. The computer counts starting from 0, so the first array item is 0, the second is 1, and the third is 2. Also, you only have 3 objects in the array, so hero.say(a[3]) is invalid.


This is not my code:

hero.say(a[0]); // Is Error too!


The reason a[0] is null is because the first item in the array is null. Type null is not a string, therefore, you can no pass it off as an item in an array. Also, a[3] is intentionally wrong, you’ll have to remove the line.


I repeat :
This is not my program, this is documentation! Hint 2 about hero.say(a[0]) is misleading.


your code is okay. it worked with mine page