简体   繁体   English

Netlogo:每次滴答重置事件,但滴答计数器继续

[英]Netlogo: resetting event every tick, but tick counter goes on

Trying to let a flood appear with every tick and make it disappear after every tick as well.试图让洪水在每次滴答声中出现,并让它在每次滴答声后消失。 Meanwhile, the tick counter should go on.同时,滴答计数器应为 go。 The flood appears this way:洪水是这样出现的:

to water_rise
 ask patches [  ; saturates cell
  if is-DEM < 800[
      set cell-storage cell-storage + fill-rate
    ]
  ]

  ask patches [
    if any? neighbors4 with [ any? turtles-here ] [
      set cell-storage cell-storage + fill-rate
    ]
  ]
  ask patches [
    if cell-storage > 0 [
      if cell-storage > 5 [
        set cell-storage 5
        if not any? turtles-here [
          sprout 1 [
            set color blue
            set size 10
            set shape "circle"
          ]
        ]
      ]
      set pcolor cell-storage + 82
    ]
  ]
end

Currently trying to figure out how to let the flood disappear after/or within this the tick, so that it can reoccur in the next one.目前正在尝试弄清楚如何让洪水在这个滴答声之后/或之内消失,以便它可以在下一个滴答声中再次发生。 I´m not aiming to reset the tick counter, it should reach 200. Tried resetting the ticks, but only to manage resetting everything.我的目的不是重置滴答计数器,它应该达到 200。尝试重置滴答,但只能设法重置所有内容。

Any ideas?有任何想法吗? Thank you very much in adavance非常感谢你

Cheers干杯

You can simply use the display primitive to update the view without waiting for the tick counter to advance.您可以简单地使用display基元来更新视图,而无需等待滴答计数器前进。

I am not familiar with your whole model but here's a conceptual example that may help:我不熟悉你的整个 model 但这里有一个概念性的例子可能会有所帮助:

to water_rise
  ...
end
    
to go
  repeat 100 [
    water-rise
      display
    ]
  tick
end

This code would execute your water-rise procedure 100 times, update the view with new patch colors after each execution, and only increase the tick counter by 1 after the repeat loop is done.这段代码将执行你的水上升过程 100 次,每次执行后用新补丁 colors 更新视图,并且只在repeat循环完成后将滴答计数器增加 1。

Here is the link to NetLogo Dictionary entry about the display primitive: http://ccl.northwestern.edu.netlogo/docs/dictionary.html#display这是有关display原语的 NetLogo 词典条目的链接: http://ccl.northwestern.edu.netlogo/docs/dictionary.html#display

Note: due to its design, NetLogoWeb does not support the display primitive.注意:由于其设计,NetLogoWeb 不支持display原语。 So, you need to use the desktop version.所以,你需要使用桌面版。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM