无法在嵌套询问中访问自己的[我自己]

时间:2019-05-06 16:45:01

标签: nested netlogo

我想计算乌龟(我们称之为乌龟A)的某些链接的重量平均值,称为“ fs”。 特别是,我需要选择与另一只乌龟B具有“ C”类关联的乌龟,并使用此代理集计算甲鱼fs链接的权重平均值。 我正在和一个记者,mean-fs一起做。  要选择要计算均值的链接,我需要嵌套一些询问并访问我自己的[myself],应该是乌龟A。

我尝试将乌龟A的谁传递给报告者mean-fs,但存在错误“预期字面值”。 我已经尝试过[自己],但它会返回自己。 这是我正在谈论的代码部分:

to go
ask turtles
[move
set-conv]
end

to set-conv
  ask other turtles in-cone 4 120
  [...
   if (C-neighbors != nobody)[add-partecipant]
  ]
end

to add-partecipant
  let turtle1 myself
  if ( mean-fs [ turtle1 ] > 0 )
  [ ... ]
end

to-report mean-fs [turtle1]
  let w-list []
  ask C-neighbors
  [ set w-list lput [w] of f-with turtle1 w-list]
  report mean w-list
end

0 个答案:

没有答案