💾 Archived View for gemini.ctrl-c.club › ~nttp › toys › turtle › doc › turtle.md captured on 2024-05-26 at 16:40:36.
⬅️ Previous capture (2023-09-08)
-=-=-=-=-=-=-
# Tipsy Turtle commands 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. ## Basic movement /* n -- */ forward fd /* n -- */ back bk /* n -- */ left lt /* n -- */ right rt /* n -- */ setheading seth /* x y -- */ setxy /* n -- */ setx /* n -- */ sety /* -- */ home ## Position queries /* -- x y */ pos /* -- n */ xcor /* -- n */ ycor /* -- n */ heading /* x y -- n */ towards ## Turtle state /* -- */ hideturtle ht /* -- */ showturtle st /* -- b */ shown? /* -- */ penup pu /* -- */ pendown pd /* -- b */ pendown? /* n -- */ setpensize /* -- n */ pensize ## Color commands (See the companion document Color support in Tipsy Turtle for more details.) /* r g b -- */ setpencolor setpc /* -- r g b */ pencolor pc /* r g b -- */ setbackground setbg /* -- r g b */ background bg /* n -- r g b */ palette /* r g b n -- */ setpalette ## Other drawing commands /* -- */ 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. ## How to read stack comments While a Forth tutorial is outside the scope of this document (see the included scripting guide), 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".