以下是代码:
to new_neighbor
set my-neighbors (other patches) in-radius 2
end
to go
ask patches
[ set live-neighbors count my-neighbors with [living?] ]
;; Starting a new "ask patches" here ensures that all the patches
;; finish executing the first ask before any of them start executing
;; the second ask. This keeps all the patches in synch with each other,
;; so the births and deaths at each generation all happen in lockstep.
ask patches
[ ifelse live-neighbors = 3
[ cell-birth ]
[ if live-neighbors != 2
[ cell-death ] ] ]
tick
end
这是错误:
COUNT预期输入为代理集,但得到的数字为0。 补丁30 -31运行COUNT时出错 由程序GO调用 按钮'go-once'调用
我只想将邻居扩展到24个小区。没有其他的。我希望程序检查不是前8个细胞响,而是24.
谢谢。
答案 0 :(得分:3)
查看模型库(“文件”菜单)。在代码示例部分,有一个名为'Moore& amp;冯·诺伊曼的例子'。这正是你想要的。
对于您的错误,我的邻居中没有补丁。您的代码不包含任何实际设置my-neighbors变量的部分,因此不清楚它为什么是空的。也就是说,什么位代码实际上调用了过程new_neighbor
?