如何在 netlogo 中追踪一只刚出生的乌龟
How to track a new born turtle in netlogo
在我开发的模型中,如果满足特定条件,海龟就会诞生。当一只新乌龟出生时,我想跟踪它,即如果已经有 3 只乌龟活着并且第 4 只出生了,我想知道哪只乌龟是刚出生的。
最初系统以 2 只海龟开始。因此,如果一只新海龟出生,我首先想知道这一点,然后我想根据 WHO
数字或是否有更好的方法来跟踪那只海龟。
为了确定是否有新的海龟出生,我最初想到的是在前一个时间点和当前时间点对海龟进行计数,但是由于海龟在我的模型中也可能死亡,所以如果 turtle birth and death
同时发生。
看看这是否满足您的需求:
to illustrate
ca
crt 2
print [who] of turtles
print-youngest
ask turtles [hatch 1]
print-youngest
ask turtle who-of-youngest [die]
print-youngest
end
to-report who-of-youngest
report last sort [who] of turtles
end
to print-youngest
print (word "turtle " who-of-youngest " is youngest.")
end
在我开发的模型中,如果满足特定条件,海龟就会诞生。当一只新乌龟出生时,我想跟踪它,即如果已经有 3 只乌龟活着并且第 4 只出生了,我想知道哪只乌龟是刚出生的。
最初系统以 2 只海龟开始。因此,如果一只新海龟出生,我首先想知道这一点,然后我想根据 WHO
数字或是否有更好的方法来跟踪那只海龟。
为了确定是否有新的海龟出生,我最初想到的是在前一个时间点和当前时间点对海龟进行计数,但是由于海龟在我的模型中也可能死亡,所以如果 turtle birth and death
同时发生。
看看这是否满足您的需求:
to illustrate
ca
crt 2
print [who] of turtles
print-youngest
ask turtles [hatch 1]
print-youngest
ask turtle who-of-youngest [die]
print-youngest
end
to-report who-of-youngest
report last sort [who] of turtles
end
to print-youngest
print (word "turtle " who-of-youngest " is youngest.")
end