Turtle Graphics has a pretty long history with FORTH, not just LOGO or Pascal. So I decided to write a Turtle Graphics module in PLASMA and interact with it in PLEIADES FORTH. Honestly, FORTH seems like a better match to Turtle Graphics than LOGO, which I never really got.
This was my first time actually using the RECURSE word in PLEIADES FORTH - I'm glad it worked!
My horrible video: https://www.youtube.com/watch?v=AYiaLyojo9g
32 MB Disk image: https://github.com/dschmenk/PLASMA/raw/ ... ES-2.20.po
140K floppy image: https://github.com/dschmenk/PLASMA/raw/ ... PLFORTH.po
FORTH source: https://github.com/dschmenk/PLASMA/blob ... turtle.4th
Turtle Graphics module source: https://github.com/dschmenk/PLASMA/blob ... turtle.pla
Turtle Graphics in FORTH
Re: Turtle Graphics in FORTH
Thanks for sharing the video and the source code. It's always interesting to see code running on real hardware at 6502 speed.
Your point about RECURSE working well is a nice reminder of how elegantly FORTH handles recursion for these kinds of fractal patterns.
What strikes me about Turtle Graphics is how the core concept - maintaining a "current location" with a heading that you move relative to - shows up in other places too. PostScript uses essentially the same idea with its graphics state, which tracks the "current point" along with things like the current colour, line width, and transformation matrix. When you do a moveto or lineto in PostScript, you're working relative to that state, much like FORWARD and RIGHT in Turtle Graphics.
And of course, PostScript itself is a stack-based language with a lot of FORTH DNA - the postfix notation, the operand stack, the dictionary-based name lookup. It diverges in naming conventions (PostScript tends toward verbose names like grestore rather than FORTH's terse style) and has more built-in structure for things like arrays and dictionaries, but the family resemblance is unmistakable.
Your point about RECURSE working well is a nice reminder of how elegantly FORTH handles recursion for these kinds of fractal patterns.
What strikes me about Turtle Graphics is how the core concept - maintaining a "current location" with a heading that you move relative to - shows up in other places too. PostScript uses essentially the same idea with its graphics state, which tracks the "current point" along with things like the current colour, line width, and transformation matrix. When you do a moveto or lineto in PostScript, you're working relative to that state, much like FORWARD and RIGHT in Turtle Graphics.
And of course, PostScript itself is a stack-based language with a lot of FORTH DNA - the postfix notation, the operand stack, the dictionary-based name lookup. It diverges in naming conventions (PostScript tends toward verbose names like grestore rather than FORTH's terse style) and has more built-in structure for things like arrays and dictionaries, but the family resemblance is unmistakable.
Re: Turtle Graphics in FORTH
Thanks for the reminder about PostScript. One of those languages I need to visit someday. I actually got to meet John Warnock once, about a million years ago. Still have his business card in a box.