Dig Trig
Turtle Graphics
Menu

DigTrig Turtle Graphics

When I was a wee lad in 4th and 5th grade (1984/1985), my school had a couple Apple II+ computers. One of my first programming experiences was with Apple Logo, a turtle graphics program that had a small language, but was still very much a 'programming' environment. Thus began my code monkey fate. My son (when 9 yrs old) asked me if he could learn to program... so I created this in hopes that he would find as much enjoyment as I did. He poked at it for ten minutes and walked away. Kids.

I continued to develop this a few steps further and added the ability to define your own functions. There is a way to export your functions as well as export a PNG. I also added variables and basic operations, random number generators, IF logic conditions and LIFO stacks. It's great for self-similar fractals and L-system generation!

UPDATE: I recently added the ability to resize the canvas. I also added sample code for making a 'Flowsnake', a really cool space filling curve. You can see how to leverage the stack to easily create L-system generated drawings.

In the future, I'd also like to allow you to output your design in SVG... not to mention a complete redesign of the controls and layout.

Currently Defined Functions:

Click to load onto the command line:
IE is not supported.
Get a real browser.

Sample Code: 4th stage Flowsnake (aka Gosper curve)

Copy and Paste the following: (more info on Gosper curve at Wikipedia)

TO A [SET X POP IFNZ X [SUB X 1 RP 7 [PUSH X] A R B R R B L A L L A A L B R] [FD 9]]
TO B [SET X POP IFNZ X [SUB X 1 RP 7 [PUSH X] L A R B B R R B R A L L A L B] [FD 9]]
TO R [RT 60] TO L [LT 60] TO SETUP [PU LT 90 FD 250 RT 90 FD 75 PD]
TO FLOWSNAKE [CL H SETUP PUSH 4 A] FLOWSNAKE