Netlogo创建了一个与海龟的链接,当它们都碰到同一个补丁时

Netlogo创建了一个与海龟的链接,当它们都碰到同一个补丁时,netlogo,Netlogo,也许我把这个问题写错了,但我想在代码中做的是,当另一只海龟遇到另一只海龟时,它们会彼此建立链接 我知道它是什么 to go tick make-circle move if ticks >= timer1 [stop] end to move ask turtles [ create-links-with other turtles ;here is where i want to put the code set heading random 360 fd 1] create-netw

也许我把这个问题写错了,但我想在代码中做的是,当另一只海龟遇到另一只海龟时,它们会彼此建立链接 我知道它是什么

to go
tick
make-circle
move
if ticks >= timer1 [stop]
end

to move
ask turtles
[
create-links-with other turtles ;here is where i want to put the code
set heading random 360 fd 1]
create-network
end

to create-network
  ask links [
  set thickness 0.01 * counter
if [patch-here] of end1 = [patch-here] of end2
[set counter (counter + 1)]

]
end

但是我不知道当他们相遇时,如何正确地将其命名为link我该怎么做

为你的计数建立一个品种变量。然后在与其他海龟在同一补丁上的所有海龟之间创建链接。然后,当其他海龟遇到最初的呼叫海龟时,增加计数变量。我会注意到我将count变量增加了.5,因为链接中的每个海龟都会增加它(有2个海龟,所以.5*2=1)


为你的数量建立一个品种变量。然后在与其他海龟在同一补丁上的所有海龟之间创建链接。然后,当其他海龟遇到最初的呼叫海龟时,增加计数变量。我会注意到我将count变量增加了.5,因为链接中的每个海龟都会增加它(有2个海龟,所以.5*2=1)


你说的见面是什么意思?位置是连续的,所以它们永远不会在完全相同的位置。你的意思是“在同一块地上”还是“在某一距离内”或其他什么?当两只海龟在同一块地上或在某一距离内相遇时,它们也会用链接开始计算相遇的次数。你所说的相遇是什么意思?位置是连续的,所以它们永远不会在完全相同的位置。你的意思是“在同一块地上”还是“在某一距离内”或其他什么?当两只海龟在同一块地上或在某一距离内相遇时,它们也会开始计算链接的次数
links-own [meets]

to setup
  clear-all
  crt 100 [setxy random-xcor random-ycor  ]
end

to go
  ask turtles [fd 1]
  ask turtles [rt random 90]

  ask turtles [ create-links-with other turtles-here]
  ask turtles [ ask other turtles-here [ask link-with myself [ set meets meets + .5]]]

end