Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Over the weekend I wanted to make a turtle graphics program for the 84+CSE. So, I basically wrote an interpreted language on top of TI BASIC that does it. Here are some screen shots:
A simple square:


A colorful spiral:


A recursive tree


Download here:
http://www.cemetech.net/programs/index.php?mode=file&id=1265

The language is pretty simple, but also quite powerful. You're able to run any TI-BASIC in-line, and can use BASIC variables. Here's the code for the tree:


Code:
TURTLE
"Draws a simple tree, by Shaun McFall
"TREE→Str1:{1→ʟTUR:prgmTURTLE:Return
COLOR 15
PEN 0
MOVE {80,120
PEN 1
LABEL 1
ANGLE ⁻90
FORWARD 10
PUSHVEC 1
LEFT 45
FORWARD 10
PEEKVEC 1
RIGHT 45
FORWARD 10
POPVEC 1
IF B≠30
GOTO 1


It's not super fast, which should be expected from an interpreter written on top of an already slow interpreted language. Check it out and let me know your thoughts!
Very interesting stuff Merth!
Does it support to-blocks in the style of Logo? That would be fantastic.
I've never used Logo, so I might be wrong in my understanding, but it looks like TO blocks define functions? This doesn't provide anything quite like that, though you could make your own with labels and gotos.
Yeah, Logo is essentially "LISP without as many parentheses", and to is used define functions.
Nice work Merth! I understand why it is called "Turtle graphics", but could this possibly be sped up by using shorter command names in theory? For example, RIGHT could be R and LEFT could be L? I do like the way it works though, it makes drawing difficult figures a lot easier! Smile
I think the speedup from that would be marginal, and make the language itself more difficult. The idea of this is that it's for beginner programmers to learn more about programming. In the future, when they need more speed up, it would be a fun challenge to them to implement their own that is slightly faster or has more features.

I'm also thinking of creating a turtle library that just takes a few commands and is run from a BASIC program that does the turtle stuff. That way when you want more advanced stuff you'd do something like
{1,10:prgmTURLIB
{2,90:prgmTURLIB
{1,10:prgmTURLIB
And it would be the same as
FORWARD 10
RIGHT 90
FORWARD 10

This would remove all the parsing from the engine, thus speeding that up.

Actually, now that I think about it, that'd be a cool ASM library. Maybe I should learn ASM...
Ah, that could be a nice idea. A simpler language for those just starting out could certainly be useful. Smile The next thing you know, it will be a DCSE feature. Razz

Anywho, nice job! Going to give it a whirl and make some fancy graphics. Razz
I've uploaded a new version! I've fixed the stacks, which were broken, and I've added a CIRCLE command. Also, I made this:


Download:
http://www.cemetech.net/programs/index.php?mode=file&id=1265
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement