[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> StarLogo: How does "clone" keep track of turtles?



StarLogo fans,

I recently read "Turtles, Termites, and Traffic Jams" with much
interest and have a language implementation question on the "clone"
function on page 116.

The turtle procedure on page 116 describes a StarLogo version of tree
drawing using parallel recursion.  The program has draw-branch-demon
that runs again and again.  On each execution, the turtle moves
forward with its pen down.  When it is finished, it clones itself
twice and it dies.  Each of the two turtles draws the line and when
done, clones itself twice and dies.  Then four becomes eight, and so
on until the length to draw becomes too small.  The following is the
actual draw-branch-demon:

	to draw-branch-demon
	ifelse length-gene < 2
	   [die]
	   [forward length-gene
	    clone [mutate-length-gene left 45]
	    clone [mutate-length-gene right 45]
	    die]
	end

While I can understand "create-turtles 360" can create an array of
turtle objects like turtle[0] to turtle[359] so that computer can keep
track of different turtles, I am puzzled as to how the computer can
keep track of one turtle from another when the "clone" function is
used.  

 
Your reply is appreciated.


Kenneth Cho
enjoygo@pacbell.net
---------------------------------------------------------------
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