Pet.target == 'Hero Placeholder' Python bug?

Tried to set up a meeting between the hero and the pet in Medic School level. Replaced the default while loop with:

while True:
    mushroom = hero.findByType("mushroom")[0]
    if pet.target == 'Hero Placeholder':
        hero.move(pet.pos)
    elif mushroom:
        hero.move(mushroom.pos)

and nothing happens…
The same code is working perfectly in javascript:

while (true){
    var mushroom = hero.findByType("mushroom")[0];
    if (pet.target == 'Hero Placeholder')
        hero.move(pet.pos);
    else if (mushroom)
        hero.move(mushroom.pos);
}

Can somebody confirm my finding and is it a bug?(This is not an answer - the while loop is predefined )

I append my post because I think I’ve been not sufficiently clear. The original while loop in the level is equivalent to: ( Code in JavaScript)

while(true) {
    var mushroom = hero.findByType("mushroom")[0];
    if (mushroom)
        hero.move(mushroom.pos);
}

And the result is:
normal
Using the ‘enhanced’ version at the top the hero is running toward the pet and he/she is healed ( IMO ) a little bit faster. A split of a second is often the difference between life and death…
better

The question is:
Why the code is running in JavaScript and not in Python?

Maybe you should contact @MunkeyShynes?

xython is waaaaay better at this than I am. This does appear to be a bug. It would have to be resolved by someone more advanced than I am.

But I thought you were SUPER leveled!

I don’t know what “super leveled” is but the only thing I’m super good at is surfing and skateboarding.

1 Like

ok 20000000000000000000 chars.

" waaaaay better" - oh no, I don’t think so - my knowledge is absolutely chaotic…
I see CoCo mainly as solving puzzles and in reality almost all level answers are hidden somewhere in this forum. One of the most important things in life is what you do in your ‘free time’ and I admire MunkeyShynes for his choice.

1 Like

Didn’t test in other levels but here pet.target is defined in java script and not in python. I suppose the same BUG can be found in other levels and maybe in all

1 Like