LADYBUG.DOC ·
DOC ·
69.6 KB ·
1983-09-26 ·
from CompuLink-User-Group_Software-Library_COMUG-Disk-49-LADYBUG
LADYBUG GRAPHICS
REFERENCE MANUAL
VERSION 0.9 -- PRELIMINARY
26 September 1983
David N. Smith
44 Ole Musket Lane
Danbury, CT 06810
(c) Copyright 1983 by David N. Smith
All Rights Reserved.
PREFACE
LadyBug is an implementation of a portion of LOGO Turtle
Graphics. It is distributed as "User-Supported" software which
means that you do not have to pay for it. You can copy it, give
it away, or do anything else with it except sell it.
If you find that it is useful, you are invited to make a donation
or contribution to the author. A amount of $35 is suggested but
you are free to send whatever you wish. The author is:
David N. Smith
44 Ole Musket Lane
Danbury, CT 06810
Please do not call the author; he is hard to reach and some
family members sleep odd hours. Please send mail, or leave EMAIL
on CompuServe for 73145,153.
LADYBUG STATUS
This version is still a baby. All of the function described in
the manual is present and all (most?) has been executed and found
to work. Some parts have been used fairly heavily. The author
has a wall full of pictures which came out of LadyBug at various
times over the last few months. However, glitches still lurk
hidden in unused paths.
Please let the author know what you think of LadyBug, especially:
1. What features are missing that are really needed;
2. What doesn't work;
3. What is wrong with the manual; and
4. What is not clear in the manual.
Plans for the near future include:
1. High Resolution Graphics
2. An index for the manual;
3. Spell check the manual;
4. (Possibly) list processing primitives.
The author will be happy to include in future releases any
procedures that someone sends. Be sure to say that the
procedures are for distribution. Your name will be included on
them and with the description in the manual unless you say not
to.
Preface Page ii
DISCLAIMER
LadyBug comes with no warranties of any kind; it is available AS
IS. The author would like to know of problems that users have
but makes no promise or guarantees that any problem will be
fixed.
In no event will the Author be liable for any damages, including
any lost profits, lost savings or other incidental or
consequential damages arising out of the use of or inability to
use this program, even if the Author has been advised of the
possibility of such damages, or for any claim by any other party.
COPYING LADYBUG
Clubs and other non-profit organizations as well as individuals
are granted permission by the author to freely copy these
programs and documentation and share them with their members, or
individuals with their friends, so long as:
1. No price is charged for the software or documentation.
However, clubs may charge a distribution fee for the cost of
the diskette, so long as it is not more than $6 total.
2. Club members are informed of the user-supported concept and
encouraged to support it with their donations.
3. Neither the program nor it's documentation are modified in
any way and are distributed together.
USER SUPPORTED SOFTWARE
If you are using this program and find it to be of value your
contribution ($35 is suggested) will be appreciated. Regardless
of whether you make a contribution, you are encouraged to copy
and share this program with your friends.
User-supported software is an experiment in distributing computer
programs, based on three beliefs:
1. That the value and utility of software is best assessed by
the user on his/her own system.
2. That the creation of personal computer software can and
should be supported by the computing community.
3. That copying of programs should be encouraged, rather than
restricted.
Anyone may request a copy of a user-supported program by sending
Preface Page iii
a blank, formatted disk to the author of the program along with
an addressed, postage-paid return mailer. A copy of the program,
with documentation on the disk, will be sent by return mail.
User-supported software was conceived by Andrew Fluegelman of
Headlands Press for PC-TALK. He used the name FreeWare(tm). Jim
Button, distributor of PC-FILE, coined the term user-supported
software.
SOURCE
LadyBug is distributed as compiled Basic; source is NOT
distributed nor is it available.
HOW TO GET LADYBUG
If you do not have LadyBug, or if your copy is not current, you
can get a new copy by sending the author one of the following:
1. A diskette and a postage paid mailer. You get LadyBug with
documentation on disk.
2. A diskette with a 9x12 self-addressed postpaid envelope. You
get LadyBug and hardcopy documentation.
In any case, please mark LADYBUG on the OUTSIDE of the envelope.
Send no money; it's free.
TABLE OF CONTENTS
1. ABOUT LADYBUG.......................................... 1
1.1. Why LadyBug?....................................... 2
1.2. LadyBug Features................................... 2
1.3. LadyBug Requirements............................... 3
2. RUNNING LADYBUG........................................ 4
2.1. Before You Run LadyBug............................. 4
2.2. Starting........................................... 4
2.3. LadyBug Function Keys.............................. 4
2.4. Trying Things...................................... 5
3. THE LADYBUG SCREENS.................................... 6
3.1. The Graphics Screen................................ 6
3.2. The Text Screen.................................... 7
3.3. The Editing Screen................................. 7
3.4. Using Two Displays................................. 7
4. WORDS AND STRINGS...................................... 8
4.1. Words.............................................. 8
4.2. Lists.............................................. 8
4.3. Strings............................................ 8
5. GRAPHICS COMMANDS...................................... 10
5.1. BACK length (Abbreviated BK).................... 10
5.2. BACKGROUND color (Abbreviated BG)............... 10
5.3. CLEARSCREEN (Abbreviated CS).................... 10
5.4. CLIP............................................... 11
5.5. DRAW............................................... 11
5.6. FORWARD length (Abbreviated FD).................. 11
5.7. HIDEBUG (Abbreviated HB)........................ 11
5.8. HOME............................................... 11
5.9. LEFT angle (Abbreviated LT)...................... 12
5.10. NOCLIP............................................ 12
5.11. NODRAW (Abbreviated ND)......................... 12
5.12. NOWRAP............................................ 12
5.13. PAINT paintcolor bordercolor...................... 12
5.14. PALETTE palettenumber............................. 13
5.15. PENCOLOR color (Abbreviated PC)................. 13
5.16. PENDOWN (Abbreviated PD)........................ 13
5.17. PENUP (abbreviated PU).......................... 14
5.18. RIGHT angle (Abbreviated RT).................... 14
5.19. SETHEADING angle (Abbreviated SETH)............. 14
5.20. SETX xcoord....................................... 14
5.21. SETXY xcoord ycoord............................... 14
5.22. SETY xcoord....................................... 14
5.23. SHOWBUG (Abbreviated SL)........................ 15
5.24. WRAP.............................................. 15
Table of Contents Page v
6. SOUNDS................................................. 16
6.1. BEEP............................................... 16
6.2. PLAY string........................................ 16
7. INPUT AND OUTPUT....................................... 18
7.1. CLEARTEXT.......................................... 18
7.2. CLEARINPUT......................................... 18
7.3. CURSOR column row.................................. 18
7.4. PRINT word (Abbreviated PR)...................... 18
7.5. PRINT1 word (Abbreviated PR1).................... 18
7.6. TEXTCOLUMNS columns (Abbreviated TCOLS).......... 19
8. CONTROL COMMANDS....................................... 20
8.1. EDIT procname ... (Abbreviated ED)............... 20
8.2. END................................................ 20
8.3. GOODBYE (Abbreviated BYE)........................ 20
8.4. IF condition THEN action........................... 20
8.5. IF condition THEN action1 ELSE action2............. 21
8.6. LOCAL variablename................................. 21
8.7. MAKE "variablename value........................... 21
8.8. OUTPUT value....................................... 22
8.9. RANDOMIZE number................................... 22
8.10. REPEAT number list................................ 22
8.11. RUN list.......................................... 22
8.12. STOP.............................................. 22
8.13. TOPLEVEL.......................................... 22
8.14. TO procname....................................... 23
9. MANAGING THE WORKSPACE................................. 24
9.1. CATALOG (Abbreviated CAT)........................ 24
9.2. CLEARWS............................................ 24
9.3. DEFINE "name list.................................. 24
9.4. EDIT procname ..................................... 25
9.5. ERASE procedurename................................ 25
9.6. ERASE ALL.......................................... 25
9.7. ERASEFILE filename................................. 25
9.8. ERNAME variablename................................ 25
9.9. ERNAME ALL......................................... 25
9.10. PRINTOUT variablename (Abbreviated PO).......... 26
9.11. PRINTOUT procedurename (Abbreviated PO)......... 26
9.12. READ filename..................................... 26
9.13. SAVE filename..................................... 26
10. NUMBERS AND COMPUTATIONS.............................. 27
10.1. Values............................................ 27
10.1.1. Numeric Values................................ 27
10.1.2. Mathematical Values........................... 28
10.2. Graphics Words.................................... 29
10.3. Expressions Resulting in Numbers.................. 30
10.4. Expressions Resulting in True or False............ 31
Table of Contents Page vi
11. INTRODUCTION TO THE LADYBUG EDITOR.................... 32
11.1. About the Editor.................................. 32
11.2. Invoking the Editor............................... 32
11.3. The LadyBug Editor Keys........................... 33
12. HINTS ON USING LADYBUG................................ 35
12.1. How to Print the Screen........................... 35
12.2. Tailoring LadyBug: The Profile.................... 35
12.3. The READ Command.................................. 35
APPENDIX A. ABOUT THE LADYBUG EDITOR...................... 37
A.1. The LadyBug Editor Keys............................ 37
APPENDIX B. THE PLAY COMMAND.............................. 40
B.1. Music Commands..................................... 40
B.2. Examples of Play Statements........................ 43
APPENDIX C. A GUIDE TO LADYBUG PROCEDURES................. 44
C.1. C.................................................. 44
C.2. CIRCLES............................................ 44
C.3. DRAGON............................................. 45
C.4. DUOPOLY............................................ 45
C.5. HILBERT............................................ 45
C.6. INSPI.............................................. 45
C.7. LSQUARE............................................ 46
C.8. POLY............................................... 46
C.9. POLYSPI............................................ 46
C.10. RAIL.............................................. 46
C.11. RAYS.............................................. 47
C.12. RECT.............................................. 47
C.13. RSQUARE........................................... 47
C.14. SNOWFLAK.......................................... 47
C.15. SOUNDS............................................ 47
C.16. SPINSQ............................................ 48
C.17. SPIRALSQ.......................................... 48
C.18. SQUARE............................................ 48
C.19. TREE.............................................. 48
C.20. TREES............................................. 49
APPENDIX D. LADYBUG FILES................................. 50
APPENDIX E. LIMITS AND CAPACITIES......................... 51
1. ABOUT LADYBUG
LadyBug is a graphics language based on LOGO Turtle Graphics. It
contains most of the graphics commands, procedure making
commands, and control commands from the Apple II(1)
implementation of LOGO done by Terrapin, Inc. This version is
described in the book LOGO FOR THE APPLE II, by Harold Abelson,
published by McGraw-Hill in 1982. It is very similar to other
versions for the Apple II, Texas Instruments, and TRS-80(2)
computers.
This manual describes the LadyBug language but is not an
introduction to LOGO. We highly recommend the book LOGO FOR THE
APPLE II for it's very understandable presentation of LOGO and
for it's many examples.
DISCOVERING APPLE LOGO by David D. Thornburg is another very
readable, although less complete, introduction to LOGO. It was
published by Addison-Wesley in 1983. It describes a different
APPLE implementation than does LOGO FOR THE APPLE II. The
differences are generally minor.
For children or adults who are going to work with children, the
book LEARNING WITH LOGO, McGraw-Hill, 1983, is highly
recommended. It is written by a person who is both an elementary
teacher, and who has worked with the LOGO group at MIT for many
years.
The book TURTLE GEOMETRY, Abelson and diSessa, MIT Press, 1980 is
recommended for more advanced users. It takes the form of a
college text book on mathematics using Turtle Graphics as the
mechanism.
Of course, MINDSTORMS, Seymour Pappert, Basic Books, 1980. is
the ultimate source of WHY LOGO.
____________________
(1) Apple II is a Trademark of Apple, Inc.
(2) TRS-80 is a Trademark of Tandy.
About LadyBug Page 2
1.1. WHY LADYBUG?
LadyBug was written as an introduction to LOGO and Turtle
Graphics.(3) The author recommends that those with a serious need
for LOGO use a commercial version of LOGO rather than LadyBug.
There are several reasons:
1. LadyBug doesn't do as much.
2. LadyBug is not supported. If you have a bug, then you may
have a bug forever.
3. LadyBug will not grow and progress with time.
4. LadyBug is not as well documented.
5. LadyBug will not perform as well as a good commercial LOGO.
1.2. LADYBUG FEATURES
LadyBug is a version of LOGO patterned after the Apple II
implementation developed by Terrapin, Inc. In general it has:
- All of the graphics commands.
- All of the mathematical computations.
- All of the control commands.
In addition it has:
- A large library of procedures adapted from a variety of
sources.
- Painting of areas.
- Clipping of drawings (as well as wraparound).
- A fast full screen editor.
- Support for using both displays if both are present.
- Sounds -- PLAY statement like Basic.
The major features missing are:
- List manipulation.
- Variable numbers of parameters to primitives.
- Saving screen images.
____________________
(3) In particular, it was done for the author's children;
thoughts of distribution only came later.
About LadyBug Page 3
1.3. LADYBUG REQUIREMENTS
LadyBug requires a system with at least:
- 128K of memory.
- One single sided disk drive. (But two, or a double sided are
recommended).
- A graphics adaptor.
- A graphics display of any kind. (Color is supported only on
a color display; 80 column editing is supported only on a
high resolution monitor.)
- DOS 1.1 or 2.0
- An IBM PC.
2. RUNNING LADYBUG
2.1. BEFORE YOU RUN LADYBUG
The LadyBug diskette should be backed up. Never run the only one
you have if you value being able to run it tomorrow.
LadyBug is initially distributed on single sided diskettes. If
you have double sided drives you should copy the files onto a
diskette formatted for double sided use.
2.2. STARTING
Boot DOS up. Put the LadyBug diskette into the A: drive.(4) Type
"LADYBUG". After a few seconds you will be in LadyBug command
mode.
2.3. LADYBUG FUNCTION KEYS
The LadyBug function keys control how LadyBug programs run or
stop them from running. They may be used any time that LadyBug
is running, but not when it is waiting for input. (In the
editor, the function keys have different meanings.)
F1
Stop a running procedure.
F9
Switch on or off TRACE mode. When it is on, each command
that is executed is displayed and LadyBug pauses for you to
press any key.
F10
Hide or unhide the display of the Lady Bug herself. (She
looks like an arrow due to the radiation armor she wears!)
Procedures run faster when she is hidden but are easier to
understand when she is visible.
____________________
(4) See the DOS manual for information about how to make the
LadyBug diskette contain enough of DOS to boot up itself. With
an AUTOEXEC.BAT file on the diskette you can have LadyBug start
up automatically when the machine is turned on.
Running LadyBug Page 5
2.4. TRYING THINGS
The procedure POLY is built into LadyBug. (POLY is a simple and
commonly used illustration of LOGO.) To try something, type
DRAW(5) and then type one of these:
poly 100 120
poly 100 144
poly 100 162
Press F1 to stop the drawing; it will continue to run, retracing
its path, until you stop it. If you press F10 while the figure
is being drawn then the lady bug hides. Press it again to get
her back.
There are many examples which come with LadyBug; they are briefly
described in appendix C. Try this:
read "polyspi
polyspi 5 144 5
Press F1 to stop it. Then try:
polyspi 1 45 1
Or try:
polyspi 5 175 5
POLY is a three statement procedure. POLYSPIRAL is too. The
wide variations in each come from minor changes in how far a line
is drawn and how much of a turn is then made. It is difficult to
believe that the three POLYSPI drawings come from the SAME
trivial program.
____________________
(5) DRAW tells LadyBug you want to do graphics; you only have to
do it once at the start.
3. THE LADYBUG SCREENS
This chapter describes the different views of LadyBug seen on the
screen.
3.1. THE GRAPHICS SCREEN
When LadyBug starts up it is not in graphics mode. To get into
graphics mode, type "DRAW". Commands which draw are allowed.
Commands which display text do so in a small area at the bottom
of the screen.(6)
Graphics mode is re-entered each time you give the DRAW command.
The graphics screen is 300 units high by 500 units wide. The
center is the origin.
150 +----+----+----+----+----+----+----+----+----+----+
| |
| |
100 + +
| |
| |
50 + +
| |
| |
0 + + (center) +
| |
| |
-50 + +
| |
| |
-100 + +
| |
| |
-150 +----+----+----+----+----+----+----+----+----+----+
-250 -200 -150 -100 -50 0 50 100 150 200 250
Graphics Screen Coordinates
The lady bug starts at the center of the screen facing towards
the top of the screen. This direction has a heading of zero.
Turns to the right are considered positive and to the left are
considered negative.
____________________
(6) In the initial version this area is one line of up to 80
characters.
The LadyBug Screens Page 7
3.2. THE TEXT SCREEN
In text mode, LadyBug does not allow graphics but does allow a
full screen of text. Text mode is entered with the NODRAW
command.
3.3. THE EDITING SCREEN
The editing screen replaces whichever screen is active when the
EDIT or TO commands are given. When editing ends, the previous
screen type is restored but the screen is clear.
3.4. USING TWO DISPLAYS
If present, the monochrome display is used as the text screen and
the editing screen. The graphics display always contains the
graphics screen.
4. WORDS AND STRINGS
This chapter describes the kinds of words which are used in
LadyBug commands.
4.1. WORDS
Words are groups of characters separated from each other by
blanks.
Example:
fred ***** 2@3
Each of "fred", "*****", and "2@3" are words.
Some special words, such as those starting with a left bracket
("[") or a quote mark may contain blanks; see below.
4.2. LISTS
Lists start with a left bracket and end with a right bracket.
Examples of lists include:
[This is a list of words]
[ [This is a list] [of lists] ]
Within a list, the number of left and right brackets are counted.
The end of the list occurs after the right bracket which
corresponds to the starting left bracket.
4.3. STRINGS
Strings are words which start with a quote mark. Examples of
strings are:
"frank
"[
Strings may contain characters, such as a left bracket, which
would otherwise be taken as something else. Strings can also
contain blanks:
Words and Strings Page 9
Example:
"'This is a string with blanks'
The second character is an apostrophe; this means that every
character up to the next apostrophe (or the end of the line) is a
5. GRAPHICS COMMANDS
This section describes the LadyBug graphics commands. These
commands move and turn the turtle, paint areas, and control which
colors are used. These commands are valid in graphics mode.
5.1. BACK LENGTH (ABBREVIATED BK)
Takes one number as input. Moves the turtle backwards,
that is in the opposite way from which it is facing,
the distance given by the number.
Example:
BACK 50
5.2. BACKGROUND COLOR (ABBREVIATED BG)
Takes a number from 0 through 15 as input. Sets the
color according to the following table:
0 Black 8 Gray
1 Blue 9 Light Blue
2 Green 10 Light Green
3 Cyan 11 Light Cyan
4 Red 12 Light Red
5 Magenta 13 Light Magenta
6 Brown 14 Yellow
7 White 15 High-intensity White
The change takes place immediately for the entire
screen. Until you set a background, it is black.
5.3. CLEARSCREEN (ABBREVIATED CS)
Takes no inputs. Clears the graphics screen but does
not change LadyBug's position or direction.
Graphics Commands Page 11
5.4. CLIP
Takes no inputs. Tells Ladybug that lines drawn by the
lady bug are to be trimmed at the edge of the screen.
If WRAP has previously been given, it is turned off.
(That is, CLIP also does a NOWRAP.) See WRAP for more
information.
The screen acts like a window onto a large flat sheet
on which the lady bug draws. Only that part which is
visible through the window is seen.
5.5. DRAW
Takes no inputs. Clears the graphics screen and resets
LadyBug to her home position and direction. (Also see
the HOME command.)
5.6. FORWARD LENGTH (ABBREVIATED FD)
Takes one number as input. Moves the turtle forward,
that is in the direction it is facing, the distance
given by the number.
Example:
FORWARD 50
5.7. HIDEBUG (ABBREVIATED HB)
Takes no inputs. Makes the lady bug disappear from the
screen. May also be written as HIDETURTLE (abbreviated
as HT).
5.8. HOME
Takes no inputs. Moves the lady bug to the center of
the screen and points her straight up.
Graphics Commands Page 12
5.9. LEFT ANGLE (ABBREVIATED LT)
Takes one input, an angle from -360 to 360. Rotates
the lady bug that many degrees counterclockwise.
Example:
LEFT 90
5.10. NOCLIP
Takes no inputs. Tells LadyBug that an attempt to pass
the edge of the screen will not cause the lady bug's
path to be clipped. See WRAP and CLIP for more
information.
5.11. NODRAW (ABBREVIATED ND)
Takes no inputs. Exits from graphics mode and enters
text mode. Clears the screen. Places the cursor in
the upper left corner.
With two screens, the graphics screen is unchanged; the
text screen is enabled for output commands. See
chapter 3. for more information about screens.
5.12. NOWRAP
Takes no inputs. Tells Ladybug that an attempt to pass
the edge of the screen will not cause the lady bug to
wrap around to the other side. See WRAP and CLIP for
more information.
5.13. PAINT PAINTCOLOR BORDERCOLOR
Paint the area below the lady bug with the painting
color. Painting is done in each direction until the
border color is reached (or the edge is reached).
If the border color is the same as the pen color, and
the pen is down, the dot under the pen acts like a
border and no painting occurs. To be safe, lift the
pen and move forward a slight amount.
Painting colors are the same as pen colors; see
PENCOLOR for information.
Graphics Commands Page 13
5.14. PALETTE PALETTENUMBER
Takes one input, a zero or a one. Sets the palette
number. See PENCOLOR for information on the colors in
each palette.
5.15. PENCOLOR COLOR (ABBREVIATED PC)
Takes one input, a number from 0 to 3. The number is
the color of the lines that the lady bug will draw.
The colors are:
--- Palette ---
color 0 1
1 Green Cyan
2 Red Magenta
3 Brown White
A color of zero is the same color as the background.
(See the BACKGROUND command.) Until you select a
background, Ladybug uses a black background.
Until you select a pen color, LadyBug uses color 3.
Palettes are selected with the PALETTE command; until
you select a palette, Ladybug uses palette one.
Example:
PENCOLOR 2
5.16. PENDOWN (ABBREVIATED PD)
Takes no inputs. When the pen is down, the lady bug
draws when she moves.
Graphics Commands Page 14
5.17. PENUP (ABBREVIATED PU)
Takes no inputs. When the pen is up the lady bug does
not draw when she moves.
5.18. RIGHT ANGLE (ABBREVIATED RT)
Takes one input, an angle from -360 to 360. Rotates
the lady bug that many degrees clockwise.
Example:
RIGHT 47
5.19. SETHEADING ANGLE (ABBREVIATED SETH)
Takes one input, an angle from -360 to 360. Rotates
the lady bug so that it points in the direction given.
An angle of zero is straight up and increasing numbers
are clockwise.
5.20. SETX XCOORD
Takes one input, an x coordinate. Positions the lady
bug at the position, drawing a line if the pen is down.
5.21. SETXY XCOORD YCOORD
Takes two inputs, x and y coordinates. Positions the
lady bug at the new position, drawing a line if the pen
is down.
5.22. SETY XCOORD
Takes one input, an y coordinate. Positions the lady
bug at the position, drawing a line if the pen is down.
Graphics Commands Page 15
5.23. SHOWBUG (ABBREVIATED SL)
Takes no inputs. Makes the lady bug appear on the
screen. May also be written SHOWTURTLE (abbreviated
ST).
5.24. WRAP
Takes no inputs. Causes the lady bug to "wrap around"
when it is moved past an edge. For example, a path
that goes off the top of the screen will continue at
the bottom of the screen.
This is the default condition. The NOWRAP, CLIP, and
NOCLIP statements also affect what happens when the
lady bug tries to go off of the edge.
If neither WRAP nor CLIP are in effect, Ladybug signals
an error when the lady bug tries to go off of the edge.
6. SOUNDS
This section describes Ladybug commands for making sounds with
the PC speaker.
6.1. BEEP
Play one short note on the speaker.
6.2. PLAY STRING
Play a series of notes on the speaker.
This sections describes only a part of the PLAY
command. The appendix "The Play Command" on page 40
describes PLAY completely.
The PLAY statement is the word "PLAY" followed by a
string which contains special music commands. These
commands define notes to play, or tell PLAY how to play
the notes.
Note: Spaces and capitalization in the PLAY statement
are optional.
A TO G WITH OPTIONAL '#', '+', OR '-'
Play the note given. Append a # or + if the note is a
sharp or a - if it is a flat.
LN
Set the default length of all notes which follow. For
example, L1 means that all notes are whole notes, L2
means half notes, and L4 means quarter notes. The
default is L4.
O N
Set octave n as the current octave. All notes given as
letters are in this octave. The default octave is 4.
The value of n may be 0 through 7.
An octave has the notes C, D, E, F, G, H, A and B in
it, in that order. The octave does NOT start with the
note A.
Sounds Page 17
P N
Pause for n time units. The meaning of the value of n
is the same as in the L command. The value of n may
range from 1 to 64.
7. INPUT AND OUTPUT
This chapter describes statements which read or write data, which
control the text screen, or which sense what is happenning with a
keyboard or joystick.
7.1. CLEARTEXT
Takes no inputs. Clears the text screen. Moves the
cursor to the top left corner.
7.2. CLEARINPUT
Takes no inputs. Clears the input buffer of text typed
but not yet read.
7.3. CURSOR COLUMN ROW
Takes two inputs which are a column and row position.
The cursor is positioned at that place on the text
screen. The allowed values of the numbers depend upon
which screen size is in use. The column may be 1-40
(or 1-80 depending upon the number of text columns) and
the row may be 1-25.
7.4. PRINT WORD (ABBREVIATED PR)
Takes one input which it prints on the current output
device. Moves the cursor to the next line. (See
OUTDEV.)
7.5. PRINT1 WORD (ABBREVIATED PR1)
Takes one input which it prints on the current output
device. Leaves the cursor on the same line.
Input and Output Page 19
7.6. TEXTCOLUMNS COLUMNS (ABBREVIATED TCOLS)
Takes one input, either the number 40 or the number 80.
Sets the screen width for text mode on the graphics
monitor. If the text screen is on the monochrome
display it always has a width of 80.
8. CONTROL COMMANDS
This chapter describes commands which are used to define
variables and procedures.
8.1. EDIT PROCNAME ... (ABBREVIATED ED)
Takes a variable number of inputs. Enters the full
screen editor to edit the procedures. The chapter
"Introduction to the LadyBug Editor" on page 32
describes this command and how to use the editor.
8.2. END
Mark the end of a procedure which is entered from the
editor. It may be omitted from the last procedure but
must be present if there is more than one procedure in
the editors space.
8.3. GOODBYE (ABBREVIATED BYE)
Exit to DOS from LadyBug.
8.4. IF CONDITION THEN ACTION
Test the condition. If it is true, then perform the
action.
The condition is a word or expression which returns
"true" or "false".
The action is one or more LadyBug commands.
Example:
if :x > 0 then fd 100
if :ready then fd 50 rt 45 fd 100 rt 45 fd 50
Control Commands Page 21
8.5. IF CONDITION THEN ACTION1 ELSE ACTION2
Test the condition. If it is true, then perform
action1; if it is false, then perform action2.
The condition is a word or expression which returns
"true" or "false".
The actions are one or more LadyBug commands.
Example:
if :x > 0 then fd 100 else fd 50
if :ready then fd 50 rt 45 else bk 20 lt 10
8.6. LOCAL VARIABLENAME
Defines a variable as being local to the current
procedure. It is available to any procedures which are
called from the procedure in which it is defined unless
they too make the name local or have an input variable
with the same name.
The variable has a null (empty) value until some value
is assigned with the MAKE command.
Example:
local "saveit
8.7. MAKE "VARIABLENAME VALUE
Takes two inputs, a word which will be a variable name,
and a value. Assigns the value to a variable with the
name given. The value may be referenced by using the
variable name with a colon on the front anywhere a word
may be written.
Example:
make "a 7
make "b 3 *
make "c (
Control Commands Page 22
8.8. OUTPUT VALUE
Takes one input. Causes the current procedure to stop.
The value is output to the calling procedure.
8.9. RANDOMIZE NUMBER
Takes one input, an integer. Sets the seed of the
random number generator to this value. Each time the
same seed is used, calls to RANDOM will return the same
set of random numbers.
8.10. REPEAT NUMBER LIST
Takes two inputs, a number and a list. RUNs the list
as many times as the number indicates.
Example:
repeat 4 [forward 100 right 90]
8.11. RUN LIST
Takes one input, a list. Executes the list as if the
body were typed as a command line.
8.12. STOP
Takes no inputs. Causes the current procedure to stop
and return control to the procedure which called it, or
to the command prompt. No value is output.
8.13. TOPLEVEL
Takes no inputs. Stops all active procedures and
returns to the command prompt.
Control Commands Page 23
8.14. TO PROCNAME
TO is a synonym for the EDIT command.
9. MANAGING THE WORKSPACE
This chapter describes statements which are used to control and
manage the workspace.
9.1. CATALOG (ABBREVIATED CAT)
Takes no inputs. Prints the names of files contained
on the current disk. The current screen is cleared and
the catalog is displayed as if in text mode.
9.2. CLEARWS
Takes no inputs. Clears all variables and procedures
from the workspace.
9.3. DEFINE "NAME LIST
Takes two inputs which define a procedure. The first
is the name of the procedure and the second is the body
of the procedure.
If a procedure already exists with the name given, it
is deleted first.
The body of the procedure is a list of lists. Each
sublist is one line of the procedure. The first
sublist lists the names of the inputs to the procedure.
Example:
to tri :s
repeat 3 [fd :s rt 120]
end
is given as:
define "tri [[:s][repeat 3 [fd :s rt 120]]]
If there are no inputs then the first list is empty:
Example:
define "circ [[][fd 10 rt 10 circ]]
Managing the Workspace Page 25
9.4. EDIT PROCNAME ...
Edit one or more procedures. See the chapter
"Introduction to the LadyBug Editor" on page 32 for
more information.
9.5. ERASE PROCEDURENAME
Delete the procedure named. If used from within a
procedure, only those procedures DEFINEd within the
current procedure level can be erased.
9.6. ERASE ALL
Delete all procedures. If used from within a
procedure, only those procedures DEFINEd within the
current procedure level will be erased.
9.7. ERASEFILE FILENAME
Erase the disk file named.
9.8. ERNAME VARIABLENAME
Delete the variable named. If used from within a
procedure or repeat block, only those variables which
have been created since the invocation of the current
procedure or repeat block can be erased.
9.9. ERNAME ALL
Delete all variables. If used from within a procedure
or repeat block, only those variables which have been
created since the invocation of the current procedure
or repeat block are erased.
Managing the Workspace Page 26
9.10. PRINTOUT VARIABLENAME (ABBREVIATED PO)
Print the value of the variable.
9.11. PRINTOUT PROCEDURENAME (ABBREVIATED PO)
Print the value of the procedure.
9.12. READ FILENAME
Load the named workspace and add its variables and
procedures to the workspace. If no file extension is
given, the default of .BUG is used.
Example:
read "polyspi
read "b:circ.lgo
See the chapter "Hints on Using LadyBug" on page 35 for
more information about uses of READ.
9.13. SAVE FILENAME
Save the current workspace in the file named. If no
file extension is given, the default if .BUG is used.
Example:
save "bobby
See the chapter "Hints on Using LadyBug" on page 35 for
more information about uses of READ.
10. NUMBERS AND COMPUTATIONS
This section describes numbers and how to compute with them.
10.1. VALUES
Numeric values come in two types, integer, and floating point.
Integer numbers have only whole number values. These values must
be in the range of -32768 to 32767.
Floating point numbers have whole number and fractional values.
Their value in the computer may range from 2.9E-39 to 1.7E38
(where the E-39 means "times ten to the -39 power" and E38 means
"times ten to the 38th power".) When you enter the numbers into
the computer, they must have one of the forms:
mmmmm. .nnnnn mmmmm.nnnnn
where "mmmmm" is a number from -32767 to +32767 and "nnnnn" is a
number from 0 to 32767. Exponents may not be entered.(7)
10.1.1. NUMERIC VALUES
Several words in Ladybug have values. None of the following take
any inputs:
BACKGROUND (Abbreviated BG)
The background color.
DAY
The day of the month.
HEADING
The angle that the LadyBug is currently facing.
HOUR
The hour of the day (as 0 through 23).
MINUTE
The minute of the hour.
____________________
(7) The format of numbers is restricted temporarily; eventually,
a more normal number representation will be allowed.
Numbers and Computations Page 28
MONTH
The month of the year.
PALETTE
The palette number.
PENCOLOR (Abbreviated PC)
The color of the pen.
SECOND
The second of the minute.
XCOR
The current x coordinate of the lady bug.
YCOR
The current y coordinate of the lady bug.
YEAR
The year as four digits (e.g. 1983).
10.1.2. MATHEMATICAL VALUES
These Ladybug words take one value (an expression) and return a
number.
ABS number
Returns the absolute value of the number.
ARCTAN angle
Returns the arc-tangent of the angle in degrees.
COS angle
Returns the cosine of the angle in degrees.
EXP power
Returns 'e' raised to the power given.
INTEGER number
Makes the number into an integer and returns the integer.
LOG number
Returns the logarithm of the number taken to base 10.
RANDOM range
Returns a random number in the range 0 to 'range'. (See the
RANDOMIZE statement for more information.)
SIGN number
Returns +1 if number is positive, 0 if number is zero, and -1
if number if negative.
Numbers and Computations Page 29
SIN angle
Returns the sine of the angle in degrees.
SQRT number
Returns the square root of the number.
TAN angle
Returns the tangent of the angle in degrees.
10.2. GRAPHICS WORDS
The following words return values.
STICK n (or PADDLE n)
Takes a number from 0 to 3 which corresponds to one of four
joysticks and returns a number from 0 to 255 which represents
it's setting. The range of values will depend upon the
particular joystick used.
STICKBUTTON n (or PADDLE n)
Takes a number from 0 to 3 which corresponds to one of four
joysticks and returns TRUE or FALSE depending upon whether or
not the button on the particular joystick has been pressed
since the last time PADDLEBUTTON was used.(8)
RC?
Takes no inputs. Outputs TRUE if a keyboard character is
pending, that is, if the character input buffer is not empty.
Otherwise it outputs FALSE.
READCHARACTER (Abbreviated RC)
Takes no inputs. Outputs the least recent character in the
character buffer, or waits for a character if the buffer is
empty.
REQUEST (Abbreviated RQ)
Takes no inputs. Waits for an input line to be typed and
outputs the line. The line is terminated by pressing the
enter key. Until the enter key is pressed, the backspace key
will move back over and delete characters that have been
typed. The back arrow key will move back over and allow
insertions and deletions with the Ins and Del keys.
____________________
(8) This is not compatible with Terrapin LOGO which returns TRUE
only if the button is currently pressed. To see if the button is
down, do two in a row.
Numbers and Computations Page 30
10.3. EXPRESSIONS RESULTING IN NUMBERS
Numbers can be combined into expressions. Expressions are
evaluated from left to right with no operator hierarchy.
Parentheses may be used to group operations which should be
performed first.
Expressions are taken, word by word, with only blanks separating
words. Operators, numbers, and parentheses must be separated by
blanks to be properly recognized. For example, this is invalid:
FORWARD 3+4
but this is valid:
FORWARD 3 + 4
Expressions may occur anywhere that LadyBug is looking for a
number. Even though an expression may have many words in it, it
is still considered as one input.
Unless noted, operations on integers result in integers and
operations on floating point numbers result in floating point
numbers. When one operand is integer, it is converted to
floating point.
The operators are:
+ (plus)
Returns the sum of two numbers.
- (minus)
Returns the difference of two numbers.
* (times)
Returns the product of two numbers.
/ (divide)
Returns the result of dividing the first number by the second
number. If both are integers, they are converted to floating
point before the divide is done.
^ (power)
Returns the second number raised to the power given by the
first number. The second number must be an integer or
LadyBug signals an error.
\ (mod)
Returns the remainder of dividing the second number by the
first number. If either is floating point, they are rounded
to integers first.
Numbers and Computations Page 31
Example:
forward 3 * ( 2 + 5 )
right 5 * :x
right ( 5 * :x )
print integer 100 * sin 4 + :angle
print integer ( 100 * sin ( 4 + :angle ) )
The last two lines print the same result.
10.4. EXPRESSIONS RESULTING IN TRUE OR FALSE
Expressions which result in TRUE or FALSE are like expressions
which result in numbers and may have such expressions in them.
Each operation has the following form:
value1 op value2
where the values are numbers, variables, or expressions and "op"
is one of the following relational operators:
<
Returns TRUE if value1 is less than value2.
<=
Returns TRUE if value1 is less than or equal to value2.
>
Returns TRUE if value1 is greater than value2.
>=
Returns TRUE if value1 is greater than or equal to value2.
<>
Returns TRUE if value1 is not equal to value2.
=
Returns TRUE if value1 is equal to value2.
11. INTRODUCTION TO THE LADYBUG EDITOR
This chapter describes the basics of using the LadyBug full
screen editor. The appendix "About the LadyBug Editor" on page
37 describes additional features of the editor.
11.1. ABOUT THE EDITOR
The LadyBug Editor is a full screen editor for LadyBug
procedures. It displays procedures up to 200 lines long and with
lines up to 254 characters long on a monochrome display or 40 or
80 column graphics display. The screen is a window onto the
file. The window can move up, down, left and right. Lines which
are longer than the screen are partly displayed. If you insert
data, characters seem to be lost off of the end of the line; they
are not lost but are just no longer displayed. Move the cursor
off of the screen to the right and they will reappear as the
window moves.
If memory nears the limit while you are editing, the LadyBug
Editor tells you and lets you continue editing but won't let you
add more lines.
11.2. INVOKING THE EDITOR
Command: EDIT procname ... (Abbreviated ED)
Takes a variable number of inputs. Enters the full screen editor
to edit the procedures. The chapter "Introduction to the LadyBug
Editor" on page 32 describes how to use the editor.
The procedures named are displayed, each ending with an END
statement. Lines may be changed, added, deleted, or moved. When
multiple procedures are being edited, lines may be moved between
procedures.
If a procedure is deleted in the editor, or it's name is changed,
it is not deleted from the workspace. Only those procedures
which are still in the editors space when you terminate editing
are moved back to the workspace. New procedures created within
the editor are added to the workspace when you edit from the
editor. Use the ERASE statement to delete procedures from the
workspace.
Introduction to the LadyBug Editor Page 33
11.3. THE LADYBUG EDITOR KEYS
The following list defines the meaning of each key.
Backspace
Backspace over and delete the previous character.
Character keys, shifted or unshifted.
Enter the character into the current line. If in insert
mode, put it at the cursor position and slide the characters
under and to the right of the cursor to the right. If in
replace mode, replace the character under the cursor.
Cursor keys (arrows on numeric keypad)
Move the cursor up, down, left, or right one position. If
the cursor would move off of the screen in a direction in
which there is more data, then scroll the screen one
character in that direction.
Del
Delete the character under the cursor.
End
Position the cursor past the end of current line.
Enter key
Put a new line in the file and position the cursor at the
front of it.
F5
Clear the current line and position the cursor at the left
edge.
F6
Clear the current line under and to the right of the cursor.
F7
Quit editing. Abandon the procedure(s) being edited. (If
any changes have been made, the editor asks before
abandoning them.)
F9
End editing. Save the procedure(s) being edited.
Home
Position the cursor in the first column of both the current
file line and the screen.
Ins
Toggle between insert and replace modes. The status line
describes which is in effect. The cursor also changes size.
Introduction to the LadyBug Editor Page 34
Pg Dn
Scroll down 20 lines.
Pg Up
Scroll up 20 lines.
Shift-F8
Delete the line at the cursor. The cursor moves to the next
line in the file.
Tab
Tab right to the beginning of the next word. (Words are
groups of characters separated by blanks.)
12. HINTS ON USING LADYBUG
This chapter contains several helpful hints about how to use
LadyBug effectively.
12.1. HOW TO PRINT THE SCREEN
Under DOS 2.0 (or later systems) you must give the GRAPHICS
command in DOS before running LadyBug. Under DOS 1.1 or 1.0
there is no way to print the graphics screen unless you have a
GRAPHICS command distributed for that version by IBM.
12.2. TAILORING LADYBUG: THE PROFILE
When LadyBug starts up, it READs a workspace named PROFILE.BUG
from the B: drive. This workspace file can be modified to
contain any LadyBug commands; when it is read, these commands
will be executed.
For example, the PROFILE might contain:
pencolor 1
background 7
12.3. THE READ COMMAND
The READ command described on page 26 causes LadyBug to divert
reading commands from the keyboard. Commands are taken from the
file named.
Any LadyBug command can be in the file. However, there is no way
to create a file from within LadyBug which contains arbitrary
commands. It is necessary to use a program called an "editor" to
create the file.(9)
The READ command can itself occur within a READ command. And
another READ in that one, and another read in that one. The
limit is four active READ commands.
When LadyBug starts up, it READs a file named PROFILE. This file
____________________
(9) The author of LadyBug has a free editor called FRED which
will create such files; send a diskette in a self-addressed,
post-paid diskette mailer for a free copy. However any editor
will do, including the EDLIN program which comes with DOS.
Hints On Using LadyBug Page 36
may be modified to perform any action you wish as a part of the
startup process.
READ files can be created which contain long sequences of
commands to draw large pictures. The commands are executed and
discarded; they do not take space in the workspace unless they
are MAKE or DEFINE commands.
APPENDIX A. ABOUT THE LADYBUG EDITOR
This appendix describes the LadyBug editor completely. It
repeats the introductory information given in the main part of
the document.
The LadyBug Editor is a full screen editor for LadyBug
procedures. It displays procedures or groups of procedures up to
100 lines long and with lines up to 254 characters long on a
monochrome display or 40 or 80 column graphics display.
The screen is a window onto the file. The window can move up,
down, left and right. Lines which are longer than the screen are
partly displayed. If you insert data, characters seem to be lost
off of the end of the line; they are not lost but are just no
longer displayed. Move the cursor off of the screen to the right
and they will reappear as the window moves.
If memory nears the limit while you are editing, the LadyBug
Editor tells you and lets you continue editing but won't let you
add more lines.
The LadyBug Editor is similar to the IBM Personal Editor; most of
it's keys are the same and its approach to handling the screen is
about the same.
A.1. THE LADYBUG EDITOR KEYS
The following list defines the meaning of each key. The term
"current line" means the line the cursor is currently on.
Alt-d
Delete a marked area; see Alt-l for more information.
Alt-j
Join the next line onto the current one at the end.
Alt-l
Mark the current line or extend a group of marked lines.
The first Alt-l marks a line and displays it in reverse
video. The second marks all lines from the first one
through the second. Further Alt-l keystrokes extend the
marked area to the current line (or shrink it from the
nearest edge).
Marked areas may be copied or deleted. See Alt-d, Alt-u,
and Alt-z.
About the LadyBug Editor Page 38
Alt-s
Split the current line into two parts at the cursor. At
column one this adds a new lines before the current one.
Alt-u
Unmark an area; see Alt-l.
Alt-z
Copy a marked area to just after the current line. A marked
area cannot be moved into itself.
Backspace
Backspace over and delete the previous character.
Character keys, shifted or unshifted.
Enter the character into the current line. If in insert
mode, put it at the cursor position and slide the characters
under and to the right of the cursor to the right. If in
replace mode, replace the character under the cursor.
Ctrl-End
Position the cursor on the last line of the file. Keep it
in the same column.
Ctrl-Home
Position the cursor on the top line of the file. Keep it in
the same column
Ctrl-Left
Move the cursor to the left 40 positions.
Ctrl-Pg Dn
Position the cursor at the bottom edge of the screen (or on
the last line of the file if encountered first). The column
position is unchanged.
Ctrl-Right
Move the cursor to the right 40 positions.
Cursor keys (arrows on numeric keypad)
Move the cursor up, down, left, or right one position. If
the cursor would move off of the screen in a direction in
which there is more data, then scroll the screen one
character in that direction.
Del
Delete the character under the cursor.
End
Position the cursor past the end of current line.
About the LadyBug Editor Page 39
Enter key
Put a new line in the file and position the cursor at the
front of it. (Also see Alt-J.)
F5
Clear the current line and position the cursor at the left
edge.
F6
Clear the current line under and to the right of the cursor.
F7
Quit editing. If any procedure has been changed, you will
be prompted for a 'y' before The LadyBug Editor really
quits.
F9
Stop editing. Re-enter LadyBug mode with the changed
procedure(s).
Home
Position the cursor in the first column of both the current
file line and the screen.
Ins
Toggle between insert and replace modes. The status line
describes which is in effect.
Pg Dn
Scroll down 20 lines.
Pg Up
Scroll up 20 lines.
Shift-F4
Undo a change to the current line. Once the cursor is moved
from the line the change cannot be undone with this key.
Shift-F8
Delete the line at the cursor. The cursor moves to the next
line in the file.
Tab
Tab right to the beginning of the next word. (Words are
groups of characters separated by blanks.)
APPENDIX B. THE PLAY COMMAND
This appendix describes the PLAY command completely, repeating
information contained in the summary in the main part of this
document.
The PLAY statement is the word "PLAY" followed by a string which
contains special music commands. These commands define notes to
play, or tell PLAY how to play the notes.
Note: Spaces and capitalization in the PLAY statement are
optional.
B.1. MUSIC COMMANDS
A TO G WITH OPTIONAL '#', '+', OR '-'
Play the note given. Append a # or + if the note is a sharp or a
- if it is a flat.
LN
Set the default length of all notes which follow. For example,
L1 means that all notes are whole notes, L2 means half notes, and
L4 means quarter notes. The default is L4.
The value of n may vary from 1 to 64. The actual note length is
1/n. That is, if n is 8 then the note has a length of 1/8.
Unless changed by the T command, each quarter note lasts 1/2
second.)
The default length may be changed for any note by appending a
different length to it. For example, in
PLAY "'L4 a b c8'
the notes 'a' and 'b' will be played as quarter notes but 'c'
will be an eighth note.
MB
Tell PLAY to play music in the background; that is, to start the
music playing and to proceed to the next statement. If LadyBug
then finds another SOUND or PLAY statement, it pauses until the
tune is complete. Up to 32 notes (or rests) may be played in the
background. MB is NOT the default.
Once you have given the MB command in one PLAY statement that all
The PLAY Command Page 41
further PLAY statements run in the background.
MF
Play music in the foreground; that is, wait for the music to
complete before proceeding to the next statement. This is the
default.
MN
Play notes the "normal" length of time. (MN means Music Normal.)
This is defined as 7/8th of the time specified by the note
length. The other 1/8 of the time is silence.
ML
Play notes the full time specified by the note length. (ML means
Music Legato). There is NO pause between notes.
MS
Play notes 3/4 of the time specified by the note length. (MS
means Music Staccato.) The other 1/4 of the time it rests.
N N
Play note n. The value of n may range from 0 to 84 with 0
meaning a rest (no sound). Note 1 is the C of octave zero.
O N
Set octave n as the current octave. All notes given as letters
are in this octave. The default octave is 4. The value of n may
be 0 through 7. For example, the following two commands are
equivalent:
PLAY "O0c
PLAY "N1
An octave has the notes C, D, E, F, G, H, A and B in it, in that
order. The octave does NOT start with the note A.
The table below shows the frequencies for each note. The values
in octaves three and above have been rounded to integers. The
minus signs mean "flat".
The PLAY Command Page 42
---------------- Octave ----------------
Note 0 1 2 3 4 5 6
------ ----------------------------------------
c 32.7 65.4 130.8 262 523* 1046 2093
c# d- 34.6 69.3 138.6 277 554 1109 2217
d 36.7 73.4 146.8 294 587 1175 2349
d# e- 38.9 77.8 155.6 311 622 1244 2489
e 41.2 82.4 164.8 330 659 1318 2637
f 43.7 87.3 174.6 349 698 1397 2794
f# g- 46.2 92.5 185.0 370 740 1480 2960
g 49.0 98.0 196.0 392 784 1568 3136
g# a- 51.9 103.8 207.7 415 831 1661 3322
a 55 110 220 440 880 1760 3520
a# b- 58.3 116.5 233.1 466 932 1865 3729
b 61.7 123.5 246.9 494 988 1975 3951
* - Middle C
Frequencies for Seven Octaves
P N
Pause for n time units. The meaning of the value of n is the
same as in the L command. The value of n may range from 1 to 64.
T N
Set the tempo. The tempo is the number of quarter notes per
minute The value of n may range from 32 to 255. The default is
120.
This means that there are 120 quarter notes per minute or that
each quarter note begins 1/2 second after the previous quarter
note.
A DOT (.)
A dot, placed after a note, causes the note to be played 3/2 the
time it would otherwise be played. A second dot multiplies the
length again by 3/2 giving a result of 9/4 the time of the
original note. Dots may also appear after the P and N commands.
Note: There are two kinds of dotted notes in music; those with a
dot BELOW the note which means staccato, and those with one or
two dots AFTER the note which means to change the note timing.
PLAY's dot convention differs from that used in normal music
notation where the first dot after a note adds 1/2 of the note
time, and a second dot adds 1/2 of 1/2 to the note time. Thus a
note with double dots would have a length of 7/4 of its original
length rather than the 9/4 that PLAY has.
The PLAY Command Page 43
DEFAULTS
A note about defaults: the defaults given are what you get when
LadyBug first starts up. However, if you change the default in
one PLAY statement, it stays changed for further statements.
B.2. EXAMPLES OF PLAY STATEMENTS
This sections illustrates the use of the Play statement. The
workspace named SOUNDS contains all of the following examples of
Play and additional ones.
First, a space ship:
Example:
to ship1
play "'L64 T255'
repeat 10 [play "'n40 n42 n44 n46 n48 n50 n48 n46 n44 n42 n40']
Now, a clock ticking:
Example:
to clock :tics
play "'L50 MB MS T255'
repeat :tics [play "'N1 P1 N2 P1']
And now, a bird call:
Example:
to bird1
play "'L64 MB ML T255 O4'
play "'N64 N66 N68 N70 P64'
play "'N66 N68 N70 N72 N74 N76 N78 P64'
play "'N66 N68 N70 N72 P64'
play "'N64 N66 N68 N70 P64'
play "'N70 N72 N74 N76 N78 N80 P64'
play "'N66 N68 N70 N72 P64'
APPENDIX C. A GUIDE TO LADYBUG PROCEDURES
This chapter describes the workspaces which come with LadyBug.
Each section name below is the name of a workspace. Issue the
command:
READ "name
C.1. C
to c :size :level
Draws a "C". curve. Adapted from a procedure in TURTLE GRAPHICS.
Try:
C 5 11
C.2. CIRCLES
to rcp :r
to lcp :r
to rarc :r
to larc :r
to rcircle :r
to lcircle :r
to shrinkcircle :size
to rslinky :size
to spinslink :size
to growcircle :size
A set of circle drawing tools from LOGO FOR THE APPLE II. Try:
shrinkcircle 100
rslinky 50
spinslinky 50
growcircle 10
A Guide To LadyBug Procedures Page 45
C.3. DRAGON
to dragon :size :order
Draws a dragon curve. Taken from TURTLE GRAPHICS. Try:
dragon 5 11
C.4. DUOPOLY
duopoly :side1 :angle1 :side2 :angle2
From TURTLE GRAPHICS. Try:
duopoly 12 10 12 -15
duopoly 18 19 18 -20
duopoly 45 90 45 320
duopoly 12 10 4 -15
C.5. HILBERT
hilbert :size :level
From TURTLE GRAPHICS page 98. Draws a Hilbert curve. Try:
hilbert 10 3
hilbert 5 5
C.6. INSPI
to inspi :side :angle :inc
From various LOGO books. Draws an inward spiral with an
increasing inturning angle; it thus eventually turns out. Slight
differences in the angle make totally different pictures. For
example, try:
inspi 10 10 15
inspi 10 10 16
inspi 10 10 10
inspi 10 10 7
A Guide To LadyBug Procedures Page 46
C.7. LSQUARE
to lsquare :side
A square drawn with left turns.
C.8. POLY
to poly :side :angle
The basic LOGO procedure. It draws polygons. Try:
poly 100 90
poly 100 120
poly 100 144
poly 100 162
C.9. POLYSPI
to polyspi :side :angle :inc
Very similar to POLY but the side is incremented after each time
it is drawn. Try:
polyspi 1 45 1
polyspi 5 119 3
polyspi 5 120 3
polyspi 5 144 3
C.10. RAIL
to rail
Rail plays a familiar old song but with a complexity that seems
impossible considering the instrument. It is adapted from
RAIL.BAS which was on a disk someone gave the author of LadyBug;
there was no name on the RAIL program. Other procedures in the
workspace are rail1 through rail15 and are called by rail. Try:
rail
A Guide To LadyBug Procedures Page 47
C.11. RAYS
rays :angle :incangle :len :inclen
Draws rays around starting lady bug point. The rays start at
:angle and with a length of :len. After drawing each, the angle
and length are incremented. Try:
rays 0 7 20 1
rays 0 13 5 1
rays 0 5 100 0
rays 0 7 100 0
C.12. RECT
to rectangle :height :length
Draw a rectangle.
C.13. RSQUARE
to rsquare :side
A square drawn with right turns.
C.14. SNOWFLAK
to snowflake :size :level
Draws a snowflake. Try:
snowflake 100 2
snowflake 100 3
C.15. SOUNDS
to ship1
to ship2
to ship3
to clicks
to clock :tics
to bird1
to bird2
to bird3
to bird4
A Guide To LadyBug Procedures Page 48
A number of different sounds. Ships are space ships, not ocean
ships. The clock ticks the number of times given.
C.16. SPINSQ
to spinsquares :size
Draws a square and turns 20 degrees to the right. Repeats the
process. Try:
spinsquares 50
C.17. SPIRALSQ
to spiralsq :side
From LOGO FOR THE APPLE II. Draws a square with the given size.
Rotates the turtle 45 degrees and draws another square with a
side the length of the diagonal of the first square. Repeats the
process with even increasing squares. Try:
spiralsq 10
C.18. SQUARE
to square :side
The same as RSQUARE.
C.19. TREE
to tree :size
From LOGO FOR THE APPLE II. Try:
tree 50
A Guide To LadyBug Procedures Page 49
C.20. TREES
to vee
to branch
to bush
to greentree
to treemove
to trees
From LOGO FOR THE APPLE II. Try:
trees
APPENDIX D. LADYBUG FILES
The following files are a part of the LadyBug package.
Filename Contents
------------ --------------------------------------------
LADYBUG.LST A ready-to-print LadyBug document
(what you are reading now)
LADYBUG.EXE The LadyBug Program
LADYBUG.GET A short note about how to get LadyBug.
*.BUG A number of LadyBug programs adopted from
various published LOGO sources. The filename
is the workspace name.
ADDENDA.LST Notes and comments about the current version
of LadyBug.
APPENDIX E. LIMITS AND CAPACITIES
Maximum total procedures and variables in workspace
100
Maximum procedure, repeat, and parenthesis nesting depth
100
Maximum number of editor lines
200
Maximum procedure size, in characters
254 (temporary restriction)
Procedures can appear to nest much deeper than the limit of 100
due to the recognition of "tail recursion". When the last thing
a procedure does is call itself, LadyBug recognizes that it need
not keep information about the old procedure call around since it
is essentially done. Therefore such a call does not count
against the limit.