对于我的模型,此程序应该计算被汽车撞到的人数,但似乎如果一辆汽车同时撞上有两个人的补丁,它只会算作一个,而不是两个,我也想不出解决办法。
to record-accidents
let collisions patches with [any? cars-here with [speed > 0 or Law-Abiding? = 0] and any? people-here]
if any? collisions
[
ask collisions
[
set autonomous-death-toll autonomous-death-toll + count patches with [any? people-here and any? cars-here with [autonomous? = true]]
set regular-death-toll regular-death-toll + count patches with [any? people-here and any? cars-here with [autonomous? = 0]]
我不确定它的相关性,但是每当我检查界面上的补丁并使用发芽命令要求创建其他品种时,我总是会询问该品种,但始终会给出汽车形状,即使我有5种不同的犬种设置。
以人为视角,请参见How to check if 2 different breeds of turtles are on the same patch的答案。您正在计算存在冲突的补丁,但您想统计人员。