What about this. Sorry, a global variable is used. Also a property list. ; First, lets define the inverse moves (ways) Pprop "inverse "lt "rt Pprop "inverse "rt "lt Pprop "inverse "bk "fd Pprop "inverse "fd "bk ; This should be run first to ini make "retrace [] end ; Moves' controller. It does the atomic move specified in the :waylist ; and keeps a list of inverse ways to move :waylist run :waylist push "retrace (list gprop "inverse first :waylist last :waylist) show :retrace end ; It runs the :retrace list using the specified :color to unmove :color localmake "pc pencolor localmake "rt :retrace make "retrace [] setpc :color foreach :rt [move ?] setpc :pc end --------------------- Let's try this cs ini move [fd 10] [[bk 10]] ; this is output of the "show :retrace" in "move" move [fd 10] [[bk 10] [bk 10]] move [rt 45] [[lt 45] [bk 10] [bk 10]] move [fd 10] [[bk 10] [lt 45] [bk 10] [bk 10]] move [rt 45] [[lt 45] [bk 10] [lt 45] [bk 10] [bk 10]] move [fd 10] [[bk 10] [lt 45] [bk 10] [lt 45] [bk 10] [bk 10]] unmove 5 ; in color 5 [[fd 10]] [[rt 45] [fd 10]] [[fd 10] [rt 45] [fd 10]] [[rt 45] [fd 10] [rt 45] [fd 10]] [[fd 10] [rt 45] [fd 10] [rt 45] [fd 10]] [[fd 10] [fd 10] [rt 45] [fd 10] [rt 45] [fd 10]] ; the inverse of [[bk 10] [lt 45] [bk 10] [lt 45] [bk 10] [bk 10]] unmove 3 ; in color 3 [[bk 10]] [[bk 10] [bk 10]] [[lt 45] [bk 10] [bk 10]] [[bk 10] [lt 45] [bk 10] [bk 10]] [[lt 45] [bk 10] [lt 45] [bk 10] [bk 10]] [[bk 10] [lt 45] [bk 10] [lt 45] [bk 10] [bk 10]] ; the inverse of the inverse Daniel --------------------------------------------------------------- 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