> Date: Sat, 27 Sep 1997 02:39:17 +0200 > From: Yehuda Katz <yehuka@beitberl.ac.il> > Reply-to: yehuka@beitberl.ac.il > To: Olga Tuzova <olgatu@ort.spb.ru> > Subject: Re: LOGO-L> Re: Multi-Turtle programming. > Olga Tuzova wrote: > > > > Dear Yehuda, > > I'm not sure the following will suit your future Math teachers, but > > I think it'll at least bring some pleasure for you (if you haven't > > found this solution yet by yourself). > > > > Some time ago somebody, I don't remember who, sorry, posted a > > nice code for a mouse chasing the other drunk one. I've posted then > > the MSWLogo version of it. The same idea used for "Ant problem", > > where four ants, initially placed in the corners of the square and > > looking inside it, begin to chase each it's "left" neighbour, leads > > to a rather amusing picture. > > > > ------ Ant Problem ---------- > > to ant.main > > cs > > set > > move > > end > > > > to set > > setturtle 0 st > > pu setxy -100 -100 pd label "0 > > setturtle 1 st > > pu setxy -100 100 pd label "1 > > setturtle 2 st > > pu setxy 100 100 pd label "2 > > setturtle 3 st > > pu setxy 100 -100 pd label "3 > > end > > > > to dx > > setturtle 0 > > localmake "x1 first pos > > setturtle 2 > > localmake "x2 first pos > > op :x1-:x2 > > end > > > > to move > > if (abs dx)<2 [stop] > > for [i 0 3][setturtle remainder :i+1 4 > > make "direction pos > > setturtle :i > > seth towards :direction fd 3] > > move > > end > > -------------------------------------------- > > >> > Olga, > > Thank you, that was a great help. > > I'll study your programs and see what I can do with them. > > Regards... > > [[Yehuda]] > First of all, in this case the subroutine dx may be shortened. When there are four ants, one may just compare with the small number the distance to [0 0] of any turtle. But the problem could be generalized for any number of turtles. Then, I'm not sure it's easy to place ants initially around [0 0]. Or, I'm wrong? Though you asked for "plain vanilla", it would be interesting to solve this problem in 3D space. And, when you are ready, would you please share with us what you are going to do with your new students. All the best. Olga. ------------------------------------------------- Olga Tuzova, Ph.D. Computer Science teacher, International School of General Education, St.Petersburg, Russia, E-mail olgatu@ort.spb.ru URL http://www.ort.spb.ru/temp/page_tu/my_main.htm --------------------------------------------------------------- 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.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home