以下代码适用于创建摩尔社区的链接:
to setup
clear-all
ask patches [
sprout 1
]
ask turtles [
set size 0.5
]
end
to go
ask patch 0 0 [
let investor turtles-here
let neighborhood patch-set neighbors
ask neighborhood [
let turtles-in-neighborhood turtles-here
ask investor [
create-links-to turtles-in-neighborhood
]
]
]
end
然而,当我以类似的方式尝试编码(见下文)来创建到双/扩展Moore邻域的链接时,我收到一条运行时错误消息,说“一只乌龟无法链接到自己。错误,而turtle 24正在运行CREATE -LINKS-TO“和错误突出显示代码行”create-links-to turtles-in-neighborhood2“
to go
ask patch 0 0 [
let investor turtles-here
let neighborhood2 patch-set [neighbors] of neighbors
ask neighborhood2 [
let turtles-in-neighborhood2 turtles-here
ask investor [
create-links-to turtles-in-neighborhood2
]
]
]
end
非常感谢任何建议,谢谢。
答案 0 :(得分:1)