Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Netlogo 如何将一个品种的海龟x与另一个品种的海龟y联系起来?_Netlogo - Fatal编程技术网

Netlogo 如何将一个品种的海龟x与另一个品种的海龟y联系起来?

Netlogo 如何将一个品种的海龟x与另一个品种的海龟y联系起来?,netlogo,Netlogo,我试图将品种x的个体海龟与品种y的个体海龟联系起来。以下内容引发了一个错误: breed [xs x] breed [ys y] to setup clear-all create-xs 25 [] create-ys 25 [] ask x 1 [ create-link-with y 2 ] end 错误是说“x2不是Y”,我不明白,因为我要求在x1和y2之间建立链接 我很困惑,因为我知道把一只x品种的海龟和多只y品种的海龟联系起来是可行的,la: breed [xs x

我试图将品种x的个体海龟与品种y的个体海龟联系起来。以下内容引发了一个错误:

breed [xs x]
breed [ys y]

to setup
  clear-all
  create-xs 25 []
  create-ys 25 []
  ask x 1 [ create-link-with y 2 ]
end
错误是说“x2不是Y”,我不明白,因为我要求在x1和y2之间建立链接

我很困惑,因为我知道把一只x品种的海龟和多只y品种的海龟联系起来是可行的,la:

breed [xs x]
breed [ys y]

to setup
  clear-all
  create-xs 25 []
  create-ys 25 []
  ask x 1 [ create-links-with n-of 5 ys ]
end
我已经阅读了有关链接和品种的NetLogo指南,但我没有看到任何专门针对这个问题的内容


单链接版本可能吗?

世卫组织编号分配给所有海龟,而不是每个品种。因此,例如
与y 27创建链接将成功。您的X编号为0到24,您的Y编号为25到49

(顺便说一句,请注意使用世卫组织的数字很少是一个好主意——至少在实际代码中,与小测试和实验相反。
与其中一个y创建链接也会起作用,并且完全避免涉及世卫组织的数字。)