George Turtle Geometry implements only the basic (procedural) single-turtle functions of the original UCB Logo TG, not (for now) the obect-oriented multi-turtle environment of Python.
Furthermore, certain changes have been made to some of the function-names to make them more consistent, readable, an 'clojure-y' - mainly inserting hifens in multy-word function names.
We use 'standard' mode for TG as this is most in line with underlying standard math:
1. Turtle home is origo.
2. Origo is center of screen.
3. X increases to the right, Y increases upwards.
4. Degrees are counter-clocwise. 0 degrees is facing right.
Removes all graphics from screen.
Moves the turtle forward 'distance' in the direction the turtle is heading.
Negative number also possible, which results in the turtle moving backward.
Ex.: (forward 50)
Returns the current heading (angle) of the turtle relative to positive X axis, rotation counter-clockwise.
The returned number will be a positive number from 0 to 359.
Moves the turte back to the center of the screen.
Makes the turtle visible, heading 0, postion [0 0], pen-down.
Returns 'true' or 'false'.
Returns 'true' or 'false'.
Rotates the turtle counter-clockwise from current heading.
Negative number also possible, which will result in a clockwise rotation.
Ex.: (left 90)
Sets down the pen, so when the turtle moves, a line will be drawn.
Picks up the pen, so when the turtle moves, no line will be drawn.
Returns the current position (coordinates) of the turtle relative to 'origo' (center of screen.) 'x' is right, 'y' is up.
The value is a 2-item vector: [x y]
The vector can be desctructed, or 'first' or 'second' can be called on it to get just the x or y value.
(let [p (position)] ...)
(let [[x y] (position)] ...) ;; destructing
(let [x (first (position))] ...)
(rep n & body)
Repeatedly executes body (presumably for side-effects) from 0 through n-1.
(forward 50) (left 120))
Combined screen and turtle command.
Clears the screen, and center the current turtle, leaving only one turtle.
Same as calling `(clear) (home)`
Does the same as as 'left', but in opposite direction.
A test program which uses most of the avilable turtle commands.
(screen width height)
same as 'turtle', but with possibility to create different sized screen.
Rotates the turtle to the given heading. See 'heading'.
Ex.: (set-heading 90)
Sets the pen to the specified web color (String) or JavaFX Color.
(set-position [x y])
Moves the turtle to the given position. (See 'position').
If x or y are "falsy" (i.e. 'nil' or 'false'), then that part is ignored.
(set-position [30 40])
(set-position [30 nil]) ;; y is changed, only x
Makes the turtle visible.
Causes the thread to "sleep" for the number of milliseconds.
1 second = 1000 milliseconds
Ex.: (wait 2000) ;; sleep for 2 seconds
get-or-create a screen (with default size) and a turtle.
Returns turtle instance