Throughout the 1970s and 1980s many children's first experience of computer programming came from Logo, a general-purpose interpreted language most-famous for its graphical capabilities. With these, students could instruct a graphical "turtle" (or a physical hardware robot) to draw straight lines and turn corners.
Logo is little-used today, but I thought that it could benefit from a modern, web-based reimagining. And because I apparently never got over Web 2.0-style names, it's called TRRTL. (Here's the full story.)
This site works on modern desktop browsers and some mobile browsers (mobile Chrome has
reduced functionality because it does not support
Type commands to the turtle to tell it what to do. Commands are case-sensitive. For example:
rebeccapurple) or a hex code (e.g.
clear()followed by a
home(). Note the parentheses
(). You can also perform a
reset()by clicking the "reset" button near the bottom right of the screen.
Additional drawing commands include:
arc 90, 120
arc 360, 50draws a complete circle around the turtle with a radius of 50 steps and
arc 180, 30draws a smaller semicircle only to the right of the turtle.
print 'hello, turtle'
print 4+3), or variable.
Every command you execute is recorded in an array,
commandHistory, and this
is encoded into the address bar. This allows you to save yor state and carry on where you
left off simply by bookmarking the URL, or
share your work with a friend by sending it to them.
reset(), this information is discarded.
Clicking the "code editor" button near the bottom right of the screen pops up a large box into which you can write or copy-paste a multiline program. Click the green "play" button to run it. The program will remain in the code editor if you want to return to it.
Alternatively, copy-pasting code directly into the TRRTL terminal will result in that code being put into the code editor and executed immediately. You can also drag-and-drop files from your computer into the terminal to upload and execute them, enabling you to write code in your favourite text editor.
Try any of the following examples to see what TRRTL is capable of or download the source code of any to see it for yourself.
TRRTL was written by Dan Q. It makes use of CoffeeScript and jsZIP under the MIT License. All other code is released into the public domain in accordance with The Unlicense.