Classic Computer Magazine Archive COMPUTE! ISSUE 37 / JUNE 1983 / PAGE 150

turtle graphicsFRIENDS OF THE TURTLE



David D. Thornburg, Associate Editor
HES Turtle Graphics II

    I visited with the people from HES at their booth at the Las Vegas Consumer Electronics Show this January. At that time I was given a glimpse of Turtle Graphics II, a graphics language they developed for the Commodore 64. I was pleased by what I saw, and even more pleased when a preliminary copy of the language was sent for me to review.
    HES Turtle Graphics II supports two kinds of display screens - the LORES, or text, screen, and the HIRES, or 320 x 200 pixel, color graphics screen. Furthermore, this language also supports the Commodore 64 sprite graphics.
    The software package contains:

1. A program editor
2. A sprite shape editor
3. An I/O handler for disk, tape or printer, and
4. A trace mode

    While Turtle Graphics II does not have a mode for the immediate execution of commands, the program editor is so easy to use that this is not a great drawback.
    Syntactically, Turtle Graphics II is a cross between Atari PILOT and the turtle graphics portion of TI Logo. To illustrate this, I have created the listings below in Turtle Graphics II, Atari PILOT, and TI Logo. The listing is for a procedure that generates a squiral pattern similar to that used in the Friends of the Turtle emblem. To make the listings easier to compare, I have numbered all the lines and made sure that similar lines have similar numbers.
    Before analyzing the Turtle Graphics II syntax in detail, you should compare the three listings. You can see that the HES language is intermediate between TI Logo and Atari PILOT. When you examine the syntax chosen for the HES sprite graphics, the relation to TI Logo is even more evident (for example, to start or stop sprite movement, you type FREEZE or THAW).
    This is not to suggest that HES Turtle Graphics II is in any way a replacement for Logo. Logo has many features that just aren't available on other languages. But, if you want to explore turtle graphics on the Commodore 64, this language is a fine starting point.

HES Turtle Graphics II Atari PILOT TI Logo
1 LABEL SQUIRAL 1 *SQUIRAL 1 TO SQUIRAL
2 HIRES 2 GR: CLEAR 2 TELL TURTLE CLEARSCREEN
3 PEN UP 3 GR: PEN UP 3 PEN UP
4 MOVE TO 100-160 4 GR: GOTO 0,0 4 SXY 0 0
5 SETHEADING TO 90 5 GR: TURNTO 0 5 SETHEADING 0
6 PEN DOWN 6 GR: PEN YELLOW 6 PEN DOWN
7 CALCULATE Y=0 7 C: #Y=0 7 MAKE "Y 0
8 LABEL ADD 2 8 *ADD2 8 ADD2:
9 CALCULATE Y=Y+2 9 C: #Y=#Y+2 9 MAKE "Y:Y+2
10 FORWARD Y 10 GR: DRAW #Y 10 FORWARD :Y
11 ROTATE RIGHT 89 11 GR: TURN 89 11 RIGHT 89
12 TEST IF (Y>180) 12 12 TEST Y > 180
13 IF FALSE JUMP ADD 2 13 J (#Y<181): *ADD2 13 IFF GO "ADD2
14 ROUTINE END
14 E:
14 END

Nonstandard Features
Before leaving the listings, there are a few nonstandard "features" that need to be mentioned. First, the HES turtle does not start in the middle of the screen; it starts in the upper left corner. Also, the MOVE TO command accepts the Y-axis (measured from 0 at the top) first, followed by the X-axis. I know of no other language that accepts coordinates in this sequence.
    Two other nonstandard turtle characteristics involve the SETHEADING TO command. A heading of 0 degrees faces the turtle to the right (instead of straight up), and turning angles for this command increase in a counterclockwise (instead of clockwise) direction. The starting angle and starting position for the turtle make sense if you recall that the original turtle graphics package from these people used only the text display.
    None of these characteristics is a showstopper - as long as each is understood from the beginning.
    There are many features of HES Turtle Graphics II that I find delightful. The sprite editor lets you easily create shapes, change their color and magnification, and save them on tape or disk for later use. The sprite editor contains eight predefined shapes that can be changed to anything you wish. The shapes provided include a boat, rocket, truck, ball, space shuttle, house, man, and woman. Sprites can be made to wrap around the screen if so desired (this causes them to appear at the opposite edge of the screen if they are moved off one end). You can also set the speed and visibility of any sprite, and can even control a sprite's position directly with a joystick.
    The program editor lets you enter two-letter abbreviations for all commands (for example, you can enter IT instead of IF TRUE JUMP). And yet, when the program is listed, all abbreviated words are fully expanded to their English counterparts.
    While I am primarily interested in the high resolution graphics turtle, the low resolution (character-based) turtle graphics has some interesting features. One of the more powerful is the CHECK FOR command that looks for the existence of a chosen character directly ahead of the turtle. This command allows Turtle Graphics II users to create maze-solving programs.
    Turtle Graphics II is a language worth considering if you are interested in turtle graphics, but don't need the rest of the power found in Logo.

Next Time
In the last few weeks, several people have asked me for a side-by-side comparison of PILOT and Logo. The result of such a comparison includes some surprises, as you will see next month.