How do I delete turtle pen lines in netlogo?

99封情书 提交于 2019-12-24 16:14:21

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!