I found a web page containing some JavaScript I made late last year while cleaning the icons off of my desktop. I’m not sure exactly what inspired me to make it. The page I made said it follows the principle of “three rights make a left”. So maybe I got the idea when I missed a turn while driving.
The application is very simple, and in fact reminds me of a very limited type of Turtle Graphics.
Here are the key facts/constraints about the program:
- The “turtle” must move in discrete “cell-sized” increments
- The turtle can only be told to move left (L) or right (R)
- The turtle moves by turning the direction told, then moving forward one unit
- The turtle can only face four directions: up, down, left, and right. No angles in between
The result being that, much like how three rights will make a left while driving, the same applies to the “turtle” in this program:
And four rights will bring it back to where it started:
I’ve uploaded the page here, the source code is in the HTML so just view the page source if you want to see it.