This project works in Scratch 2 but I haven't taken the time to fix it for Scratch 3. Click on the green flag. Place the cursor somewhere within the letters spelling PLEDGE. Be patient, the robot will move towards the cursor and when it touches the cursor it starts to implement the Pledge maze-solving algorithm. See Notes and Credits for a short discussion of the main points of the Pledge algorithm. This project is the second of three Pledge Algorithm projects. Project 1 at http://scratch.mit.edu/projects/2814655/
John Pledge was a 12 year-old English school student. He invented the algorithm that bears his name. His algorithm collects local information by adding turns to the left as positive numbers and turns to the right as negative values in to a variable called Total Turning. Total Turning is initially set to zero. The robot then moves forward until it strikes a barrier. It turns left, adding the angle measure of the turn to Total Turning and then executes the rest of the algorithm until Total Turning equals zero (not 360) at which point the robot has navigated around the barrier. The algorithm resets Total Turning to zero and moves forward until it strikes another barrier. To implement the Pledge algorithm, one has only to successfully code the robot so that it escapes from the interior of the letter G. A complete discussion of the Pledge algorithm can be found in the book Turtle Geometry by Harold Abelson, Andrea A. diSessa, The MIT Press, 1980.