-1
我有一套条件时遇到一只龟会死。当一只乌龟死亡时,在同一个蜱中,我希望这些补丁找到他们最近的新乌龟。我写了下面的代码Netlogo:如何使补丁找到最近的龟后,其先前的龟死亡
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]]
]]
的问题是在哪个龟死亡,对他们来说,死乌龟是最接近的补丁不发现在同一个节拍下一个最近的龟蜱。
我还有一个子程序定义如下它抛出一个错误,因为最接近龟在agentset补丁之一是死:
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'
如何避免这种错误的问补丁选择他们新的最接近的乌龟在他们的老最接近的乌龟死的同一个蜱中。
感谢任何帮助。谢谢
它的工作原理。我记得尝试过,但当时没有工作。尽管如此,感谢您的帮助。 – Yuvaraj