NetLogo:如何将乌龟的标题传递到半径范围内的另一只乌龟?

时间:2014-03-18 15:31:31

标签: netlogo

一只乌龟到达一个点,并且在一段时间内,可以将它与其范围内的其他海龟联系起来。

伪代码

if any? turtles within 5
[pass on heading to other turtle]

我假设的另一只乌龟需要打电话来使用这个标题,所以像

伪代码

if has received heading?
set heading new heading

此外,我需要反转此标题,以便接收航向的海龟不会在此航向上行驶,而是沿相反方向行驶,即另一只乌龟的行进路线

1 个答案:

答案 0 :(得分:3)

ask turtles in-radius 5 [
  set heading [ heading ] of myself
]

myself,也就是NetLogo中命名最差的原语,指的是乌龟在做询问。

相关问题