[Back to GSN Home Page] [Back to Message Index]

Global SchoolNet - Automated Message Archive

Re: LOGO-L> Microworlds




Augusto Chioccariello (augusto@itd.ge.cnr.it)
Wed, 30 Aug 1995 12:40:24 +0200

>Hi
>
>My year 5 class is currently doing a project about the body using
>MicroWorlds. One group has hatched two turtles and placed them as the
>lungs. They want to program the turtles to look as if they are
>expanding when we breathe in, and collapsing when we breathe out.
>They can get one lung to go without any problems.
>
>To expand
> repeat 20 [setsh 30 wait 5 setsh 31 wait 5]
>end
>
>They actually want both lungs to move at the same time but we can't
>get it to happen. We have tried ASK, EVERYONE, and TALKTO. The
>question is can it be done.

Yes, it can be done. In Microwords it's possible to have more than one
think to happen at the same time launching two or more processes to execute
instructions in parallell. The Microworld primitive to launch a proces is
"launch."
If you just use "everyone" or a sequence of instructions with "ask" or
"talkto", the instructions are executed one after the other.

I've put two turtles named "flag1" and "flag2" on a page and written a
procedure to wave a flag:

to wave
repeat 20 [setsh "flag1 wait 5 setsh "flag2 wait 5]
end

(This is the same task you describe. Since I don't have ready made shapes for
lungs but Microwords comes with shapes for flags I decided to do it for two
waving flags)

To get the two flags to wave at the same time, type the following instructions

launch [flag1, wave] launch [flag2, wave]

Here is the description of "launch" provided in the on line vocabulary:
=======================================================================
launch word-or-list-to-run

Runs the input as an independent parallel process.
If the process is launched from the Command Center,
the cursor reappears immediately.
Use the Cancel menu item or the Stopall menu item to stop the process.
See forever.

Example:

launch [glide 1000 1]

Type the next instructions while the turtle is gliding.

rt 90
lt 90

Type a few instructions in a text box called Text1.

launch text1
=======================================================================

>We know that in LogoWriter in can because one uses the command TELL like
>
> tell [ 1 2]
> repeat 20 [setsh 30 wait 5 setsh 31 wait 5]
>
>But we don't have tell in MicroWorlds. Please help.

I'm not familiar with LogoWriter, but if you want somethink like tell in
Microworlds you could define "tell" as follows:

to tell :turtle-list :instruction-list
dolist [a-turtle :turtle-list] [launch [ask :a-turtle :instruction-list]]
end

Tell ask each turtle in the turtle-list to run the commands in the
instruction-list in parallel as separate processes.

To get the two flags to wave at the same time using tell type :

tell [flag1 flag2] [wave]

I hope this helps.

Ciao,
Augusto

/// Augusto Chioccariello tel. +39 10 6475319
/// Istituto Tecnologie Didattiche - CNR fax +39 10 6475300
/// email: augusto@itd.ge.cnr.it

---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org. Mail
questions about the list administration to logofdn@gsn.org. To
unsubscribe send unsubscribe logo-l to majordomo@gsn.org.