[starlogo-users] "min-of-turtles-with" question

Buck, Peter M peter.buck at eds.com
Wed Jun 30 09:12:07 EDT 2004


I know I can find the nearest turtle with a certain attribute like this

set distance-to-closest 99
dolist [:candidate list-of-turtles-with [color = green]] [
	let :distance [(distance (xcor-of :candidate) (ycor-of :candidate))]
	if (:distance < distance-to-closest) [set distance-to-closest
:distance]
]

but it would be nice to be able to do it something like this

set distance-to-closest min-of-turtles-with [color = green] [distance
(xcor-of :this-turtle) (ycor-of :this-turtle)]

What I've written would depend on variable :this-turtle being available in
min-of-turtles-closest.  I haven't seen any suggestion that that is so.

Is what I am dreaming of possible?

Thanks,
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://education.mit.edu/pipermail/starlogo-users/attachments/20040630/4cbb3e0e/attachment.htm


More information about the starlogo-users mailing list