[Thread Prev] [Thread Next]
> I am in a real bind. I have introduced the conditional "if" to my 8th
> grade class. We have a BIG integration product due by Thursday for a
> Science/Tech Fair. The students are simulating their experience of
> testing the velocity of water using oranges in a river. The orange
> should stop either when it hits the rope or the girl shape.
> Okay, here is the problem.
> We wrote a procedure that that says
> If touching? "orange1 "t2 [stop announce [.486 m/s]]
Others have offered various solutions, but though too late
for the deadline, the following may be of future use.
A alternative approach to this project
instead of writing a CHECK procedure for each turtle
write one which will deal with all cases.
This also saves writing an instruction for
The initial program involved FOREVER for which
the requires STOPALL or CANCEL[...] to stop it.
A more controllable method is to define
an equivalent FOREVER:
For turtle "t1
if touching? "t1 "t11
move.oranges ;REPEATS AT THIS STAGE
How can this be made to apply generally?
The currently active turtle is given by the
value of the variable WHO (In the commander try: show who)
So the number of the turtle is given by BF WHO
The number of the target turtle is 10 larger,
so the target turtle is: word "t 10 + bf who
if touching? who word "t 10 + bf who
How to get the turtles moving independently?
ask[t1 t2 t3 t4 t5][move.turtles]
would move t1 then t2 &c.
ask[t1 t2 t3 t4 t5][launch[move.turtles]]
starts them all together(well almost).
MW HELP states that LAUNCH needs STOPALL &c.
for stopping, but NOT IN THIS CASE.
Check the processes tab.
The so-called independent processes are not independent.
If you watch the speed of the slowest turtle, when the others
have stopped, the slowest turtle speeds up!
Description: Binary data
Previous by thread:
Help with Conditionals
Next by thread:
To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.