NetLogo:如何创建链接到扩展的摩尔社区

时间:2017-04-05 17:36:09

标签: netlogo

以下代码适用于创建摩尔社区的链接:

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

非常感谢任何建议,谢谢。

1 个答案:

答案 0 :(得分:1)

道歉,这是我的问题,我应该坚持下去。我一直在争夺这个问题几个小时,但答案只是创建 - 链接到"其他"龟合neighborhood2