本文介绍了如何删除netlogo中的乌龟笔行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想删除模型运行中途的乌龟笔线. 清除图"原语似乎可以达到此目的,但是我的问题是我无法直接从代理运行它,也无法使用询问观察者[清除图]".有没有一种方法可以从代理程序上下文中触发此观察者命令(我希望不会),或者还有另一种擦除乌龟笔线的方法?我使用背景颜色的笔重新绘制的解决方案是垃圾.

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.

推荐答案

使用pen-erase代替使用背景色进行重绘.如果这同样是垃圾",也许您想要更多类似此处的答案? NetLogo乌龟留下的踪迹随着时间的流逝而消失

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

关于clear-drawing仅是观察者,看来工作起来应该不太困难,例如:

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

这篇关于如何删除netlogo中的乌龟笔行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 20:12