Ben Morris
Ben Morris
Ben Morris | | @bengm | printed March 06, 2017

Teaching my 4yr old Ruby

04 October 2011    tech kids

I am learning Ruby. When I saw KidsRuby, I thought it would be fun to see how a pre-reader can handle code, and my 4 year old daughter and I have played with it for a couple evenings now. 

KidsRuby has a standard text output interface, but the real draw is the Turtle graphics. You can tell it to go forward a number of steps, turn right or left a number of degrees, set some colors, etc.

My daughter can't really read yet. I walked her through it. I'd ask questions like "How far should it go? Should it turn right or left? What color should the line be?". I would type in most of the code, leaving her to key in a number or two and click the 'run' button. The result of our first session is below.

When she was done, it was my turn. I set up a basic algorithm to loop through a series of turns. There is some magic in making a computer draw, at an animal-brain level. The gallery below has a series of images generated from the same algorithm, just tweaking parameters.

Here is the code that generated the few images:

Maybe I'll try to replicate this in the HTML5 world as a learning exercise.