[Coco] Turtle Graphics

Mathieu Bouchard matju at artengine.ca
Fri Nov 8 17:03:19 EST 2013


Le 2013-11-08 à 12:36:00, Melanie and John Mark Mobley a écrit :

> This is my Python Turtle Graphics Program.
> import turtle
> import time
> turtle.pendown()
> for a in xrange(1,9):
>  turtle.left(45)
>  turtle.forward(50)
> turtle.penup()
> time.sleep(7)

Reminds me of my Ruby/Tk program named TkTurtle.rb, which I wrote in 2001. 
After starting it, you'd write this on the prompt to draw the same octogon 
(no need to penup/pendown in this case) :

   8.times {lt 45; fd 50}

which is very close to ColorLOGO's

   REPEAT 8 (LT 45 FD 50)

It's available at :
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/15217

There has been at least another turtle library for Ruby since then, but 
I've never tried it, and I think that it's quite recent. I also think that 
it's closer to Python's, whereas my inspiration was really just ColorLOGO 
(though I didn't really mean to replicate the language, just the turtle).

  ______________________________________________________________________
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC


More information about the Coco mailing list