It might be a bug, but you are also supposed to move to the flag before picking it up with
hero.moveXY(x, y) by inputting the flag’s coordinates, but you might have a bad seed.
There’s nothing wrong with the code. It is correct and runs fine. Are you sure that you’re clicking on the Submit button and not Run? In order to use flags you have to use Submit.
Try it again. Maybe you just had a bad seed.
By the way,
pickUpFlag moves you to the flag so you can pick it up. You will eventually get
remove with advanced flags so you can remove them without moving to them, but that’s different.
But still, he is supposed to have
flag = hero.findNearestFlag("green")
over there, in order for him to use the flags, but he can just use the green flag.