Ruby Meets Logo

over 2 years ago

The Ruby Quiz a little while ago was all about turtle graphics. You remember turtle graphics from school, right? Logo? Forward 20, Right 90, etc?

It turns out its pretty trivial to implement all the basic turtle graphics operations in Ruby. My crack at it came out to about 130 judiciously commented lines. The folks at Ruby Quiz were kind enough to use mine as their example solution, so you can check out the question and my solution here.

This got me thinking. Why can't I have an interactive turtle, just like I could in Logo? So a bit of tinkering with RubyCocoa, and about 30 more lines of code and:

Type some Ruby into the box, hit the Process button, and the program executes the Ruby in the context of the Turtle object exactly as defined in the quiz.

This is a great demonstration of the powerful idea that, if you write a program in a scripting language, then having it scriptable to the lowest level is simple.

Now, to start working on the next stage of the project. Stay tuned...

Leave a comment

(required)
(required, will not be published)