我如何让我的海龟继承其他海龟的属性

how do i make my turtles inherit attributes of other turtles

我有 shopper turtles 和 destination turtles,我希望我的 shoppers 获取 destination turtles 的属性并将它们设置为自己。

  ask shopper [
        set destination min-one-of (turtles with [label = 789 ]  in-radius (360) )[distance myself] set attribute1 [attribute of destination] set attribute2 [attribute2 of destination] 
        set last-destination "clear" ]

netlogo 正在将乌龟设置为目的地,我可以面对它并改变它的颜色,但我仍然得到 "no constant"。

我认为您只是遇到了括号问题。使用:

set attribute1 [ attribute1 ] of destination ; good!

而不是:

set attribute1 [attribute of destination] ; bad!

用更多 "formal" NetLogo 术语来说,of 是一个带有两个参数的报告器:左侧的报告器块(由方括号分隔)和左侧的代理或代理集对。