Razorfray challenges

Not sure why, but once you start throwing razor disks with the first flag, the hero keeps throwing them even if there isn’t a flag. This adds a lot of rogue disks that can potentially hit the ice yak a mess up your level. The only way I could get it to stop is add an else statement with a hero.say. To see if the code was seeing a flag, I added a hero.say after if flag and it wasn’t running through the code to trigger the function. I don’t use the flags a lot so I’m not sure if I’m missing something or not.

def throwDisk(target):
    hero.throwPos(target)
    hero.removeFlag(flag)
while True:
    flag = hero.findFlag("green")
    if flag:
        throwDisk(flag.pos)

Adding to the post a while back, but specifically addressing this level.

Looks like this specific seed causes the error.
razorfray%20bad%20seed

That happens with my code as well, I’m not sure why though…
Have you been able to finish the level?
Danny

Yeah, I was able to complete the level. Figured out that you can add an else statement with a hero.say() to prevent the disks from flying non-stop and only throw them when you place your flag.

1 Like

Thanks for that tip…it worked!