Internal state of jit.turtle

    Jul 13 2012 | 1:47 pm
    I've been having a lot of fun playing around with jit.turtle and am wondering if it is possible to get it to report its internal position and heading with something like a getstate message.
    I know that getstate reports origin, angle, scale and clearmode. If you use a command like F, jit.turtle will output a linesegment message and the turtle's current position can be extracted from that message. But most commands (like f, +, -) change an internally-represented position or heading and you won't know what the intermediate states are until you execute the next F command.
    The approach that I am taking is to preprocess all commands before they go to jit.turtle and to keep track of position and heading outside of the turtle routine.
    This may seem like a weird request, but having jit.turtle report on the current heading and position allows you to composite an image of the turtle itself on the drawing (like the 'hide turtle' and 'show turtle' commands of LOGO). It also makes it easier to write programs that depend on the interaction of two or more turtles in real time.

    • Sep 16 2015 | 2:28 am
      I also just ran into this issue - anyone have a good solution?
    • Sep 16 2015 | 11:01 am
      Here is some turtle code I wrote that might be useful
    • Sep 16 2015 | 9:48 pm
      Hmm, it seems like your implementation of turtle isn't quite working for me..I'll spend a little time with it and see if I can figure it out. Is there really no convenient alternative for procedural drawing in Jitter?