💾 Archived View for gemini.ctrl-c.club › ~nttp › toys › turtle › doc › turtle.gmi captured on 2023-04-20 at 02:18:39. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

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 for more details.)

Color support in Tipsy Turtle

        /* 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

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 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".