Green flag.
You can see this algorithm in my project here: https://scratch.mit.edu/projects/69092586/