【发布时间】:2016-03-02 00:12:30
【问题描述】:
我有一套条件,遇到乌龟就会死。当乌龟死时,在同一个滴答声中,我希望补丁找到它们最近的新乌龟。我写了以下代码
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'
如何通过要求补丁在旧的最近海龟死亡的同一滴答中选择新的最近海龟来避免此错误。
感谢任何帮助。谢谢
【问题讨论】: