在 Netlogo 中存储/调用变量的值

Storing / recalling the value of a variable in Netlogo

有没有办法在 Netlogo 中存储/调用以前报价中的变量值?

我需要一种方法来回忆以前报价中的变量是什么。如果我的乌龟变量 R 在最后 3 个刻度中等于 0,我需要它来将另一个变量设置回零。

这就是我的想法。

to regression
  ask turtles [if (R = 0 from last 3 ticks [Set Oin 0 ]]
end

如何制作一个变量列表,然后将该列表的长度限制为您希望代理返回多远 "remember"

set memory []

然后在每次勾选时添加到列表中并使用

删除旧记忆
  set memory lput value memory
if length memory >= 4 [set memory but-first memory]

如果零在列表中,以某种方式改变行为

if member? 0 memory  [blah]