Netlogo:如何让补丁在其前一个乌龟死亡后找到最近的乌龟
Netlogo: How to make a patch find the closest turtle after its previous turtle died
我有设定遇到乌龟会死的条件。当一只乌龟死去时,我希望补丁在同一个滴答声中找到它们最近的新乌龟。我写了下面的代码
to party-death
ask parties [ if ( my-size = 0 and count parties > 2)
[ die ask patches [set closest-party min-one-of parties [distance myself]]
]]
问题是乌龟死亡的刻度,死乌龟最接近的补丁在同一刻度中找不到下一个最近的乌龟。
我有另一个子例程定义如下,它抛出一个错误,因为代理集中的一个补丁的最近乌龟已经死了:
to citizen-comparison
let voter-patches patches with [votes-with-benefit != 0]
let nonvoter-patches patches with [votes-with-benefit = 0]
ask voter-patches [ set voter-peccentricity [eccentricity] of closest-party]
ask nonvoter-patches [ set nonvoter-peccentricity [eccentricity] of closest-party]
That party is dead.
error while patch 0 32 running OF
called by procedure CITIZEN-COMPARISON
called by procedure ELECTION
called by procedure GO
called by Button 'Go once'
如何通过要求补丁在它们的旧最近海龟死亡的同一刻选择它们最近的新海龟来避免此错误。
感谢任何帮助。谢谢
这行得通吗?我刚刚移动了括号,以便 die
完成然后 find
to party-death
ask parties [ if ( my-size = 0 and count parties > 2) [ die ] ]
ask patches [set closest-party min-one-of parties [distance myself]]
我有设定遇到乌龟会死的条件。当一只乌龟死去时,我希望补丁在同一个滴答声中找到它们最近的新乌龟。我写了下面的代码
to party-death
ask parties [ if ( my-size = 0 and count parties > 2)
[ die ask patches [set closest-party min-one-of parties [distance myself]]
]]
问题是乌龟死亡的刻度,死乌龟最接近的补丁在同一刻度中找不到下一个最近的乌龟。
我有另一个子例程定义如下,它抛出一个错误,因为代理集中的一个补丁的最近乌龟已经死了:
to citizen-comparison
let voter-patches patches with [votes-with-benefit != 0]
let nonvoter-patches patches with [votes-with-benefit = 0]
ask voter-patches [ set voter-peccentricity [eccentricity] of closest-party]
ask nonvoter-patches [ set nonvoter-peccentricity [eccentricity] of closest-party]
That party is dead.
error while patch 0 32 running OF
called by procedure CITIZEN-COMPARISON
called by procedure ELECTION
called by procedure GO
called by Button 'Go once'
如何通过要求补丁在它们的旧最近海龟死亡的同一刻选择它们最近的新海龟来避免此错误。
感谢任何帮助。谢谢
这行得通吗?我刚刚移动了括号,以便 die
完成然后 find
to party-death
ask parties [ if ( my-size = 0 and count parties > 2) [ die ] ]
ask patches [set closest-party min-one-of parties [distance myself]]