💾 Archived View for gemini.ctrl-c.club › ~nttp › toys › turtle › doc › turtle.gmi captured on 2022-01-08 at 14:38:59. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
Tipsy Turtle supports the following vocabulary for drawing. Most of it is the same as in UCB Logo, though some words work a little differently.
(There are 35 words as of version 1.0 beta, not counting aliases.)
Arguments and return values are given in Forth-style stack comments. Distances are in pixels, while angles are in degrees.
/* n -- */ forward fd /* n -- */ back bk /* n -- */ left lt /* n -- */ right rt /* n -- */ setheading seth /* x y -- */ setxy /* n -- */ setx /* n -- */ sety /* -- */ home
/* -- x y */ pos /* -- n */ xcor /* -- n */ ycor /* -- n */ heading /* x y -- n */ towards
/* -- */ hideturtle ht /* -- */ showturtle st /* -- b */ shown? /* -- */ penup pu /* -- */ pendown pd /* -- b */ pendown? /* n -- */ setpensize /* -- n */ pensize
(See the companion document for more details.)
/* r g b -- */ setpencolor setpc /* -- r g b */ pencolor pc /* r g b -- */ setbackground setgb /* -- r g b */ background bg /* n -- r g b */ palette /* r g b n -- */ setpalette
/* -- */ clean /* -- */ clearscreen cs /* -- */ label /* n -- */ setlabelheight /* -- w h */ labelsize
Note that `label` and `labelsize` take the text to work with from the Forth scratchpad. You can set its contents like this:
( Hello, world! )
Last but not least, two commands specific to Tipsy Turtle:
/* rx ry -- */ ellipse /* rx ry -- */ fillellipse
Note that `fillellipse` uses the background color for drawing, and both words draw at the turtle's position.
While a Forth tutorial is outside the scope of this document (see the Ripen website for details), let's just say that any number entered on the command line is pushed onto a stack; command words pop any required arguments from this stack, and push back return values. A stack comment of:
/* -- */
means the following word takes no arguments and returns no values, while this:
/* x y -- n */
means "takes two numbers from the stack (x and y coordinates in this case) and puts one back".