Logo -> Ludus

This commit is contained in:
Scott Richmond 2024-12-01 19:19:06 -05:00
parent 3a7171b2e3
commit 31739b4caa

View File

@ -33,13 +33,13 @@ This book will show you how to increase this kind of excitement by encouraging y
If you are stimulated by this idea, then you are exactly who I hope you are.
### Your computer baggage
This chapter gives a very quick summary of basic Logo.
It is brief, not just because I hope that you already know a little Logo but because I expect that you are willing to use the manual that came with your copy of Logo.
In other words, I expect that you are willing to do some learning about Logo mechanics on your own.
This chapter gives a very quick summary of basic Ludus.
It is brief, not just because I hope that you already know a little Ludus but because I expect that you are willing to use the manual that came with your copy of Ludus.
In other words, I expect that you are willing to do some learning about Ludus mechanics on your own.
If you have never met Logo before, probably you have been introduced to some other computer language and most likely this other language was BASIC.
(I am saddened to think of you learning BASIC before Logo, and this book will give you the chance to right that terrible wrong.)
If you do know something about one computer language, you should be able to plunge happily into the manual of a second language--Logo.
If you have never met Ludus before, probably you have been introduced to some other computer language and most likely this other language was BASIC.
(I am saddened to think of you learning BASIC before Ludus, and this book will give you the chance to right that terrible wrong.)
If you do know something about one computer language, you should be able to plunge happily into the manual of a second language--Ludus.
I will give you some directional help, though, by suggesting what questions you need answered in your manual.
Then it will be up to you to learn the specifics.
@ -52,25 +52,25 @@ If you have had no experience with personal computers, and have never tried to l
If, on the other hand, you have access to a teacher, tutor, or friend who is willing to give you help when you ask for it--and if you are patient, curious, and tenacious--I think you should stick around.
### Programming as craft
Learning to program in Logo is very much like learning a craft.
You can read about "doing Logo" as you can read about making furniture, and you can talk to others about doing it as well.
Learning to program in Ludus is very much like learning a craft.
You can read about "doing Ludus" as you can read about making furniture, and you can talk to others about doing it as well.
But in order to develop the individual talents and skills do old needed for yourself.
For the newcomer to a craft, a master artisan can certainly be of help.
The old timer can suggest small, beginning projects that are reasonably taxing but not overly intimidating.
And by offering encouragement, he can keep the novice's spirits high.
This chapter is designed to reinitiate you into the excitement of Logo craft; all the exercises within the chapter have been fashioned by an experienced craftsman.
This chapter is designed to reinitiate you into the excitement of Ludus craft; all the exercises within the chapter have been fashioned by an experienced craftsman.
These initial projects should be copied.
All artisans begin learning their craft by copying what others have done.
This is not to deny their creativity but rather to allow for a strengthening of the basic skills that support individual creativity.
Good craftsmanship, of course, requires both skill and creative flair.
For my purposes, skills are as much frames of mind as forms of physical dexterity.
For example, in this chapter I will stress the usefulness of three such skills: first, an ability to break down big problems into smaller problems; second, a willingness to imagine yourself as "walking" shapes into existence; and third, a propensity to tinker with your Logo machinery.
For example, in this chapter I will stress the usefulness of three such skills: first, an ability to break down big problems into smaller problems; second, a willingness to imagine yourself as "walking" shapes into existence; and third, a propensity to tinker with your Ludus machinery.
Very soon (starting with the exercises at the end of this chapter, in fact) you will be asked to apply these skills to support your own kind of invention.
Craft is about building things by hand, and that is what you will be doing with Logo.
Craft is about building things by hand, and that is what you will be doing with Ludus.
### Copying and tinkering
Copying computer programs is so widespread that I had better give you my opinion about the usefulness of it all.
@ -121,38 +121,38 @@ Be careful using this glue, though; it is very flammable.
Don't smoke and glue at the same time.
### Dialects
Unfortunately, there is not just one Logo.
While some Logos are more alike than others, most have quirks.
I use Terrapin MacLogo throughout this book.
Unfortunately, there is not just one Ludus.
While some Luduss are more alike than others, most have quirks.
I use Terrapin MacLudus throughout this book.
All the procedures have been written in this dialect using an Apple Macintosh Plus.
Most of the images were generated by Logo procedures and printed on an Apple Imagewriter II printer.
Most of the images were generated by Ludus procedures and printed on an Apple Imagewriter II printer.
The rest were done by hand, mine.
> Appendix A in Brian Harvey's _Computer Science Logo Style_, volume 1: _Intermediate Programming_ (Cambridge, MA: MIT Press, 1985), gives a nice summary of the syntactic differences between Logos. It gives no help with the differences in graphics, though.
> Appendix A in Brian Harvey's _Computer Science Ludus Style_, volume 1: _Intermediate Programming_ (Cambridge, MA: MIT Press, 1985), gives a nice summary of the syntactic differences between Luduss. It gives no help with the differences in graphics, though.
You may have a different machine and a different Logo.
To make life as easy as possible, and to eliminate the need to talk about dialects, I have tried hard to avoid using those components that vary most between Logos.
The bad news: this is a book about graphics and graphics is the area in which Logos differ most.
So I skirt any graphics razzle-dazzle that might work in one Logo and not in another.
You may have a different machine and a different Ludus.
To make life as easy as possible, and to eliminate the need to talk about dialects, I have tried hard to avoid using those components that vary most between Luduss.
The bad news: this is a book about graphics and graphics is the area in which Luduss differ most.
So I skirt any graphics razzle-dazzle that might work in one Ludus and not in another.
I don't use funny pen patterns, polygons filled with patterns that look like brick walls or tile roofs, or automatic mirrors that reverse images.
There are no sprites or multiple turtles.
The only colors I use are white, black, and (very occasionally) a reversing pen color.
All the line drawings have been done with a standard, narrow-width pen.
### Caveat emptor
This is a little late for a warning, but here it is anyway: _This is not a bookabout Logo._
You will end up knowing a lot about Logo, and that is no bad thing.
But the goal of the book is to get you to build visual models, and Logo is only a means to that end.
This is a little late for a warning, but here it is anyway: _This is not a bookabout Ludus._
You will end up knowing a lot about Ludus, and that is no bad thing.
But the goal of the book is to get you to build visual models, and Ludus is only a means to that end.
God knows, we could have used Pascal.
But it just so happens that Logo is easier to learn and easier to use than most of the other languages that we could have selected.
Logo notation is neat and tidy; it looks nice on the page and that encourages visual thinking.
But most important, because Logo is so easy to play around with, it won't get in the way.
But it just so happens that Ludus is easier to learn and easier to use than most of the other languages that we could have selected.
Ludus notation is neat and tidy; it looks nice on the page and that encourages visual thinking.
But most important, because Ludus is so easy to play around with, it won't get in the way.
### Turtles are us
We will concentrate on the graphic parts of Logo.
We will concentrate on the graphic parts of Ludus.
And that means "turtle graphics."
The intent of Logo's turtle metaphor was to inspire young children to explore shapes.
The turtle is a tiny triangle of light that is moved about the screen via Logo commands.
The intent of Ludus's turtle metaphor was to inspire young children to explore shapes.
The turtle is a tiny triangle of light that is moved about the screen via Ludus commands.
As the turtle moves, it leaves a trace of light.
Children are encouraged to imagine themselves in the turtle's place and to draw a shape by walking through it, as the turtle would walk through it.
@ -161,7 +161,7 @@ Walking the turtle around an invisible circle translates the body's knowledge in
"I'm walking him forward a little bit, now I'll turn him a little, I'm walking him forward a little bit, now I'll turn him a little...
I'll keep doing this until until he's finished.
Yes, that's it; I'm back where I started."
Once said, the words are available to be transformed into Logo commands.
Once said, the words are available to be transformed into Ludus commands.
Because adult bodies may be more spatially intuitive than children's, your turtle visualizations can be far more effective than a child's.
There is a problem with adults, though; they aren't used to playing imagination games as adults and must be coaxed into it.
@ -213,7 +213,7 @@ bottom edge of the box."
That's it.
The turtle has walked around the four sides of a size 50 box, arriving back to where it started.
These prose commands would translate into Logo as:
These prose commands would translate into Ludus as:
1. `forward! (50); right! (0.25)`
2. `forward! (50); right! (0.25)`
@ -243,15 +243,15 @@ Notice that the line `repeat 4 { forward! (50); right! (0.25) }` is a kind of op
That's tidy, but it's still a bore to type two lines each time you want a size 50 box on the screen.
After all, you may want to draw 100 boxes.
Wouldn't it be convenient to be able to "tell" Logo your definition of a square and then to give that definition a name?
Wouldn't it be convenient to be able to "tell" Ludus your definition of a square and then to give that definition a name?
### Logo procedures group commands under a single name
You can group a series of Logo commands together under a single name by writing a Logo procedure.
### Ludus procedures group commands under a single name
You can group a series of Ludus commands together under a single name by writing a Ludus procedure.
The name of the procedure is a shorthand for all commands included in it.
Typing the name of the procedure tells Logo to automatically execute each line of the procedure in turn, just as if you had typed them, one after another, on the keyboard.
You can "tell" Logo your definition of a square by creating a procedure called `square`.
Logo will "remember" your definition until you either erase it or turn off your computer.
Review the defining and editing procedures in your Logo manual.
Typing the name of the procedure tells Ludus to automatically execute each line of the procedure in turn, just as if you had typed them, one after another, on the keyboard.
You can "tell" Ludus your definition of a square by creating a procedure called `square`.
Ludus will "remember" your definition until you either erase it or turn off your computer.
Review the defining and editing procedures in your Ludus manual.
### Shapes defined and drawn by procedures
Let's get on with writing the necessary procedure.
@ -266,7 +266,7 @@ fn box50! () -> {
}
```
Logo will add `box50` to all its other commands.
Ludus will add `box50` to all its other commands.
Each time you type `box50`, the turtle will draw a square of size 50.
The figure will be drawn at the turtle's current position on the screen.
Unless you move the turtle to a different starting point, each time you type `box50`, the square produced will be on top of the previously drawn figure.
@ -302,10 +302,10 @@ What about boxes of different sizes?
You could edit the `box50!` procedure every time you wanted it to draw a different size box.
You could also define many `box`-like procedures, each to draw a different size box.
But that doesn't seem very efficient, does it?
After all, Logo itself doesn't have a different `forward!` command for every possible length of line that you might wish the turtle to draw.
After all, Ludus itself doesn't have a different `forward!` command for every possible length of line that you might wish the turtle to draw.
There is not a `forward!-10` command for drawing lines of length 10 and a `forward!-43` command for drawing them 43 units long.
Logo has a single `forward!` command.
Ludus has a single `forward!` command.
Whenever `forward!` is used, an argument must be used in conjunction with it: the form is `forward!` argument.
A single argument must be typed just after `forward!`.
For example, one could type: `forward! (10)` or `forward! (43)`.
@ -342,14 +342,14 @@ Perhaps you would like to show off your designs.
You could show your pals the images in your notebook.
But seeing an image is not the same as seeing how the image is drawn, the order in which the pieces are visually assembled.
How would you go about demonstrating this?
You could retype all the Logo commands needed for your screen collage.
You could retype all the Ludus commands needed for your screen collage.
What else could you do?
Remember that Logo procedures can group a series of commands together under one name.
So let's define a new Logo procedure that will run all the necessary steps to demonstrate your design.
Remember that Ludus procedures can group a series of commands together under one name.
So let's define a new Ludus procedure that will run all the necessary steps to demonstrate your design.
Once defined, you will only have to type the demonstration procedure's name to have your designs redrawn on the screen.
Your demonstration procedure will have no arguments; it will only do one thing: generate a specific design that you want to show to your friends.
If you wish to show off with several designs, you could design specific Logo procedures to reproduce eachdesign.
If you wish to show off with several designs, you could design specific Ludus procedures to reproduce eachdesign.
Here is an example of such a demonstration procedure:
```
@ -377,13 +377,13 @@ To see the pattern defined by `demo!`, type it:
Do you have a funny feeling that this isn't enough, that we aren't producing great enough images?
Let's think about this for a while.
Drawing with Logo should not be the same as drawing with a pen or pencil.
What can be sketched quickly by hand is unbearably tedious to sketch with Logo.
You may have tried sketching with Logo by moving the turtle as you would move your sketching hand.
Drawing with Ludus should not be the same as drawing with a pen or pencil.
What can be sketched quickly by hand is unbearably tedious to sketch with Ludus.
You may have tried sketching with Ludus by moving the turtle as you would move your sketching hand.
It doesn't satisfy, and it doesn't work.
Logo is a unique medium for visual expression; don't expect it to be like other media.
Visual modeling with Logo is as different from drawing as clay modeling is different from photography.
Our Logo media is a visual modeling media.
Ludus is a unique medium for visual expression; don't expect it to be like other media.
Visual modeling with Ludus is as different from drawing as clay modeling is different from photography.
Our Ludus media is a visual modeling media.
We use it best to build models.
Why?
To encourage us to think about shapes.
@ -409,7 +409,7 @@ Play around with the collage demonstration procedure that draws it.
Tinker a bit.
Maybe you could generalize the demonstration procedure by adding an argument.
To generalize a procedure is to stretch your thinking about what it does; and that's our appropriate work, too, because it respects the uniqueness of the Logo art medium.
To generalize a procedure is to stretch your thinking about what it does; and that's our appropriate work, too, because it respects the uniqueness of the Ludus art medium.
"It's the tinkering that counts, not the artiness."
Pin that phrase over your computer screen.
@ -431,7 +431,7 @@ fn box! (edge) -> {
```
You need to add a second argument `n`.
This will tell Logo how many sides to draw.
This will tell Ludus how many sides to draw.
We can replace the `repeat 4` with `repeat n`.
`forward! (edge)` will stay the same, but what about the angle you want the turtle to turn before drawing the next side?
It surely will be different for different sided polygons.
@ -443,8 +443,8 @@ Here are some walking plans that you might issue to the turtle to do NGON.s 7.
How can you calculate the angle indicated by the "?" for any n-sided polygon?
Your geometric intuition should tell you that the turtle, after making `n` turns, will end up facing the same direction in which it started.
The amount of each individual turn will be 360 divided by thenumber of turns,or `360/n`.
(Now is the time to recall Logo's mathematical capacities.
Review the Logo notation to add, subtract, multiply, and divide.)
(Now is the time to recall Ludus's mathematical capacities.
Review the Ludus notation to add, subtract, multiply, and divide.)
You are ready to write the new procedure `ngon!`:
@ -495,7 +495,7 @@ Sketches of spinning polygons that grow or shrink as they spin
{{Figure 6: Sketches of `box`es of different spins and sizes. Bottom of p. 19.}}
### Word description of sketched ideas
"I want Logo to draw a series of polygons rotating around a common point, and I want each successive polygon to get bigger, or maybe get smaller.
"I want Ludus to draw a series of polygons rotating around a common point, and I want each successive polygon to get bigger, or maybe get smaller.
"I don't know what angle to turn between one polygon and the next, so I'll include an argument called `angle` that I can vary, to see what happens.
@ -551,7 +551,7 @@ Having put `spingon!` into motion, how do you make it stop at a stage of your ch
You need to have a way of telling it how to stop.
That's another characteristic to include as an argument.
Look at the following modification to `spingon!`.
Review the conditional commands in Logo.
Review the conditional commands in Ludus.
`if ::something:: then ::something:: else ::something::` is such a conditional.
Using the `if` form, everything becomes very tidy.
@ -570,7 +570,7 @@ fn spingon! (n, edge, angle, growth, times) -> {
```
### Boring logistics
Before ending this chapter, let me give you a few more items to review from your Logo language manual.
Before ending this chapter, let me give you a few more items to review from your Ludus language manual.
The topic that gives most students the most problems is one of the most boring things to talk about: file maintenance.
So I won't talk about it.
But please review how to save text material as files, how to retrieve material from files, how to erase files, how to catalog files, and how to print files.
@ -583,13 +583,13 @@ Here are several of my presentation rules.
First, the _many comments_ rule.
I have included wordy explanations in some of my procedures.
These comments begin with the Logo command "`&`".
These comments begin with the Ludus command "`&`".
There is, of course, no need for you to include thesecomments in your own version of my procedures.
However, it is a good idea for you to put comments in your own procedures.
Second, the _meaningful cluster_ rule.
I often include extra parentheses to group like elements into a cluster.
This is useful, for example, when an argument is composed of a collection of Logo material, but you want to see it as a single cluster of information.
This is useful, for example, when an argument is composed of a collection of Ludus material, but you want to see it as a single cluster of information.
Here is an example from this chapter.
Notice the use of comments, too.
@ -610,9 +610,9 @@ fn spingon! (n, edge, angle, growth, times) -> {
Third, the _body structuring_ rule.
Procedures should be laid out nicely on the page without too much information on anyone line.
Long procedure statements should be divided up between lines to make them more readable.
The special character "`-`" is used to indicate when a single Logo statement has been continued from one line to the next.
The special character "`-`" is used to indicate when a single Ludus statement has been continued from one line to the next.
Here is an example.
Notice that the Logo material within the [repeat brackets] would have been difficult to read if the long statement had not been divided into several short lines.
Notice that the Ludus material within the [repeat brackets] would have been difficult to read if the long statement had not been divided into several short lines.
```
fn squiggle! (a, b, n) -> {
@ -626,8 +626,8 @@ fn squiggle! (a, b, n) -> {
}
```
The symbol "`-`" indicates, of course, that the return key should not be used becausethe Logo statement continues.
Consult your own Logo manual for handling the problem of procedure layout.
The symbol "`-`" indicates, of course, that the return key should not be used becausethe Ludus statement continues.
Consult your own Ludus manual for handling the problem of procedure layout.
### Exercises
There are five exercises to explore before going on to the material of chapter 2.
@ -659,7 +659,7 @@ Second, imagine yourself as the turtle.
How would you walk through the design that `cngon!` must make?
Draw a simple diagram to describe such a "turtle walk."
You might want to divide the diagram up into individual scenes.
Later you can translate each scene in words and then into Logo notation.
Later you can translate each scene in words and then into Ludus notation.
Here is the first instance where this turtle visualization is really needed.
Let yourself go; talk out loud; get on with it without too much thinking.
@ -722,7 +722,7 @@ Diagram D: **Returning to the center of the polygon**.
Pick up your pen and back down, by an amount equal to `rad`, to the polygon's center.
Finally, put your pen down in preparationfor whatevermight comenext.
Note that you, as the turtle, have ended in the sameposition (9) as you began (1).
### A turtle walk transfonned into a Logo procedure (almost)
### A turtle walk transfonned into a Ludus procedure (almost)
No more words are necessary.
Here it is.
@ -858,7 +858,7 @@ Here are a few visual tips for Exercises 1.3 and 1.4:
{{Figure 13: `spincngon`s. Bottom of p. 32.}}
#### Exercise 1.5
Design a Logo procedure that puts polygons on the vertices of other polygons.
Design a Ludus procedure that puts polygons on the vertices of other polygons.
Hint: look carefully at the body of `cngon!`.
When does the turtle arrive at a polygon vertex?
Mark the vertex arrival place in the `cngon!` procedure.
@ -877,7 +877,7 @@ Don't forget the following tricks:
4. Divide the walk up into logical sections.
5. Note the bits you know and the bits that will need some further thought and
research.
6. Translate the words into Logo commands.
6. Translate the words into Ludus commands.
7. Test it out with realistic and totally outlandish argument values
### Notes for adaptation