Skip to content

Berkeley Logo Conformity #74

@TheTastefulToastie

Description

@TheTastefulToastie

In the Berkeley Logo User Manual the commands are implemented as full words and then aliased with shorter two-letter abbreviations and all commands are specified in screaming-case (all uppercase).

  • We currently only implement the abbreviated commands.
  • The abbreviation for BACK appears to be incorrect (currently bd).
  • Uppercase commands are not currently accepted by the interpretor. (Should be case-insensitive?)
  • It seems we should also be able to specify colors using the numbers 0-15 (see below).
Excerpt from the Berkeley Logo User Manual

GRAPHICS

Berkeley Logo provides traditional Logo turtle graphics with one turtle.
Multiple turtles, dynamic turtles, and collision detection are not supported.
This is the most hardware-dependent part of Logo; some features may exist
on some machines but not others. Nevertheless, the goal has been to make
Logo programs as portable as possible, rather than to take fullest advantage
of the capabilities of each machine. In particular, Logo attempts to scale
the screen so that turtle coordinates [-100 -100] and [100 100] fit on the
graphics window, and so that the aspect ratio is 1:1.

The center of the graphics window (which may or may not be the entire
screen, depending on the machine used) is turtle location [0 0]. Positive
X is to the right; positive Y is up. Headings (angles) are measured in
degrees clockwise from the positive Y axis. (This differs from the common
mathematical convention of measuring angles counterclockwise from the
positive X axis.) The turtle is represented as an isoceles triangle; the
actual turtle position is at the midpoint of the base (the short side).
However, the turtle is drawn one step behind its actual position, so that
the display of the base of the turtle's triangle does not obscure a line
drawn perpendicular to it (as would happen after drawing a square).

Colors are, of course, hardware-dependent. However, Logo provides partial
hardware independence by interpreting color numbers 0 through 7 uniformly
on all computers:

0  black	1  blue		2  green	3  cyan
4  red		5  magenta	6  yellow	7 white

Where possible, Logo provides additional user-settable colors; how many
are available depends on the hardware and operating system environment.
If at least 16 colors are available, Logo tries to provide uniform
initial settings for the colors 8-15:

 8  brown	 9  tan		10  forest	11  aqua
12  salmon	13  purple	14  orange	15  grey

Logo begins with a black background and white pen.

TURTLE MOTION

FORWARD dist
FD dist

moves the turtle forward, in the direction that it's facing, by
the specified distance (measured in turtle steps).

BACK dist
BK dist

moves the turtle backward, i.e., exactly opposite to the direction
that it's facing, by the specified distance.  (The heading of the
turtle does not change.)

LEFT degrees
LT degrees

turns the turtle counterclockwise by the specified angle, measured
in degrees (1/360 of a circle).

RIGHT degrees
RT degrees

turns the turtle clockwise by the specified angle, measured in
degrees (1/360 of a circle).

SETPOS pos

moves the turtle to an absolute position in the graphics window.  The
input is a list of two numbers, the X and Y coordinates.

SETXY xcor ycor

moves the turtle to an absolute position in the graphics window.  The
two inputs are numbers, the X and Y coordinates.

SETX xcor

moves the turtle horizontally from its old position to a new
absolute horizontal coordinate.  The input is the new X
coordinate.

SETY ycor

moves the turtle vertically from its old position to a new
absolute vertical coordinate.  The input is the new Y
coordinate.

SETHEADING degrees
SETH degrees

turns the turtle to a new absolute heading.  The input is
a number, the heading in degrees clockwise from the positive
Y axis.

HOME

moves the turtle to the center of the screen.  Equivalent to
SETPOS [0 0] SETHEADING 0.

ARC angle radius

draws an arc of a circle, with the turtle at the center, with the
specified radius, starting at the turtle's heading and extending
clockwise through the specified angle.  The turtle does not move.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions