Go to the inchworm project!
so you can use the project
screenshot of inchworm (inactive buttons)|
To use this project, you need the free MicroWorlds Web Player, but you do not need to know anything about MicroWorlds.
Do you know the Inchworm song from the musical, "Hans Christian Andersen"? It goes like this:
In this rather silly project, every time you click the button to "measure a new flower," a different flower is drawn and the inchworm starts measuring it while the "Inchworm" tune plays. When you click the button to find out, "How long is this flower?" the inchworm will tell you. (Now, how do you suppose a cyber-inchworm measures a cyber-flower? ... in pixels, of course!)
While you could try to make a rough guess of how long the stem is before you ask the inchworm, the real interest in this project is in understanding how it works. For those of you who own the full version of MicroWorlds, the procedures are below. (Please remember that anyone can use this online project, if you download the free MicroWorlds plug-in.) Even if you don't know anything about writing programs with MicroWorlds (a multimedia version of Logo), you might like to read this brief explanation:
There are seven "turtles" in this project. Three of them are dressed as pairs of leaves. They all move to the same spot, which is chosen randomly in the grassy area. The leaves all stamp themselves there on the grass. Then one leaf turtle stays behind while the other two leaf turtles move together to a higher spot, chosen at random. A hidden turtle dressed as the flower head moves along with them and draws a green line as it moves. Now a second leaf turtle stays behind while the final leaf turtle and the hidden flower again move randomly while drawing a green line. Then the third leaf turtle stays behind while the flower turtle shows itself and once more moves randomly while drawing.
Now the inchworm turtle appears at the base of the flower to begin "measuring" it. Just before it starts measuring, the Inchworm tune begins playing, and the words to the song are shown, one line at a time. There is one textbox holding all of the words to the song (and to the inchworm's answering song), and the "song" procedure moves the cursor down from one line to the next, in time with the music.
There are actually eight different inchworm shapes. Four of them are used when the flower is fairly straight or is bent to the right, and the other four are used when the flower is bent to the left. You can control the speed of the inchworm's movements with the speed slider.
How does the inchworm know where to move? It points itself toward the first leaf turtle along the stem and moves toward it while alternating between four inchworm shapes, and when it reaches this leaf turtle, it points itself toward the next leaf turtle and keeps "crawling," and then it points itself toward the flower head and keeps crawling. Meanwhile, a command is running to tell the inchworm that when it touches the flower, it needs to turn around. And so it begins to head back down the flower, again pointing itself toward each leaf turtle in turn. There is another command running to tell it that when it reaches the lowest leaf turtle, it should turn around again. It will keep crawling up and down this leaf forever! until you click the button again or click the other button to find out what it has measured.
The computer has actually kept track of the lengths of the three randomly-drawn sections of the stem, from the moment that the marigold was drawn. So, whether or not the inchworm finishes crawling up the stem, the "inchworm" can tell you how long the stem is. The stored number is inserted into a sentence in a textbox which is then made transparent, and a "cloud" turtle appears so that it looks like a thought bubble. A hidden "bubble" turtle moves between the inchworm and the cloud, drawing a few "bubbles" along the way. (These appear as circles on a PC and as squares on a Mac.)
The sky and grass are saved as a frozen background, and when you click on "measure_a_new_flower" again, the turtles all hide themselves and the stem and bubbles are erased.
procedures for INCHWORM
|© copyright 2001 - Wendy Petti of Math Cats. All Rights Reserved.|