问题
I want to delete only turtle pen lines from a halfway point in a model run. The "clear-drawing" primitive seems to achieve that, but my problem is that I can't run it directly from an agent, or use "ask observer [clear-drawing]". Is there a way to trigger this observer command from an agent context (I expect not), or is there another way of erasing turtle pen lines? My solution to re-draw using pens having the background color is rubbish.
回答1:
Instead of redrawing using the background color, use pen-erase
. If that's equally “rubbish”, perhaps you want something more like the answers here? NetLogo turtles leaving a trail that fades with time
About clear-drawing
being observer-only though, that seems like it shouldn't be too hard to work around, something like:
to go
let clear? false
ask turtles [
...
if ... [
set clear? true
]
...
]
if clear? [ clear-drawing ]
tick
end
来源:https://stackoverflow.com/questions/34202240/how-do-i-delete-turtle-pen-lines-in-netlogo