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.
CL : ClearH : HomeRCS value value : Reset Canvas Size to Width and HeightPU : Pen UpPD : Pen DownPC color : Pen Color (HTML color names, RGB hex as RGB or RRGGBB, RGBA hex as RRGGBBAA)FD value : Move Forward # pixelsBK value : Move Backward # pixelsRT value : Right Turn # degreesLT value : Left Turn # degreesSAVE : Saves current Position, Angle and Pen Color (pushes onto LIFO state stack)RESTORE : Restores saved Position, Angle and Pen Color (pops from LIFO state stack)NULL : Do Nothing (useful in logic conditions: IF Less Than = IFGTE x y [NULL][...])RP value [...] : Repeats [...] # times (can use REPEAT instead)TO name [...] : Creates a function of commands (call the name, or click on the button)SET var value : var = valueADD var value : var = var + valueSUB var value : var = var - valueMULT var value : var = var * valueDIV var value : var = var / valuePRCNT var value : var = var * value / 100PUSH value : Pushes value onto LIFO variable stackPOP : Pops value from LIFO variable stack (eg SET X POP)RAND : Random number 0-100RANDANGLE : Random number 0-359IFNZ value [...][...] : If value != 0 runs first, otherwise secondIFEQ value1 value2 [...][...] : If value1 = value2 runs first, otherwise secondIFGT value1 value2 [...][...] : If value1 > value2 runs first, otherwise secondIFGTE value1 value2 [...][...] : If value1 >= value2 runs first, otherwise second
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