如何在共享相同参数的海龟之间创建链接?

时间:2017-02-07 19:04:47

标签: netlogo

如果我想在共享相同参数值的海龟之间创建链接,语法是什么?

在这种情况下,家庭是我的海龟,我需要家庭与其他家庭建立链接,这些家庭拥有相同的社交网络参数值。

  ask households [if [Social-Net] of self = [Social-Net] of one-of other households [create-link]]

1 个答案:

答案 0 :(得分:0)

breed [ households household ]
households-own [ social-net ]

to setup
  clear-all
  create-households 50 [ set social-net random 10 ]
  ask households [
    create-links-with other households with [
      social-net = [ social-net ] of myself
    ]
  ]
end