Only tested in FireFox 1.5.0.6 and IE 6 - Questions, comments, complaints email me at matt.lintz -at- gmail.com (replace -at- with the usual @ sign)
Logo was one of my first experiences with programming on an Apple IIC. While this only supports a small subset of the real Logo language, and still needs a better looking turtle so you can see which way he's pointing, but still fun enough for now. The commands are not case sensitive.
When first loaded the turtle is aimed straight up or 270 degrees (0 or 360 degrees is right, 90 degrees is down, 180 degrees is left). It is positioned in the middle of the screen / canvas at 300, 225. 0, 0 is the upper left hand corner while 600,450 is the lower right. The pencolor is black or #000000, and the pensize is 1.
Move forward by the number following the command forward 50. If the pen is down a line will be drawn from the current position 50 points. If you pass through the top, bottom, left or right it makes a mess and draws the line to the other side which isn't what I want.
Turns the turtle by the given angle. right 90 turns the turtle right by 90 degrees.
Moves the turtle to the x y coordinates given. The command setpos 300 225 moves the turtle to the center of the screen. Giving a number smaller than 0 or larger than the canvas width / height will not give an error but on the next draw strange things will happen.
Sets the pensize to the given number. The command setpensize 5 sets the pensize to 5. Setting it to something smaller than 1 or other than a number will not cause an error but nothing will be drawn.
Sets the pencolor to the given color which can either be a known word color or an allowed style. setpencolor black - setpencolor #000 - setpencolor #000000 - setpencolor rgb(0,0,0) are all ways to set the pencolor to black. Setting it to something really strange will cause errors that could cause the page to need reloading.
Use penup and pendown incase you want to move the turtle withought leaving a line.
example:
pendown
forward 10
penup
forward 10
pendown
forward 10
Draws line with gaps in it.
Clears the screen and the history in the textarea will be cleared after the next command.
The repeat command can be used to repeat certain commands as many times as you wish. Right now only forward left right can be used in the repeat command.
example:
repeat 4 forward 20 right 90 (a little square)
repeat 6 forward 5 right 90 forward 5 left 90 (a little staircase)
repeat 180 forward 2 right 2 (a small circle)
I'd like to add more to this so that it more closely emulates the Logo program I used to play with like building subroutines for later calling, text handling, better error trapping, moving correctly through canvas boundries. A real turtle not a circle. But for now I'll just let it sit.