在netlogo中处理补丁时,正确的语法是什么?

在netlogo中处理补丁时,正确的语法是什么?,netlogo,Netlogo,我有下面的代码,但在尝试运行它时,我收到一条消息说“期望一个文本值”,它突出显示calidad… 我猜这是因为我写括号的方式有问题 to check-if-dead if habitat = "escarabajo" [ ask escarabajos [ if count escarabajos-here > capacidad-de-carga-bosques [die] ; beetles that reach patches that alre

我有下面的代码,但在尝试运行它时,我收到一条消息说“期望一个文本值”,它突出显示calidad…
我猜这是因为我写括号的方式有问题

to check-if-dead
 if habitat = "escarabajo" [
  ask escarabajos [
      if count escarabajos-here > capacidad-de-carga-bosques [die] ; beetles that reach patches that already have a # above the carrying capacity die 
      if patch-here = [calidad "baja"] [
        if random 100 > probabilidad-de-supervivencia-calidad-baja [die]
      ]
      if patch-here = [calidad "alta" ] [
        if random 100 > probabilidad-de-supervivencia-calidad-alta [die]
      ]
    ]
  ]

在我的宇宙中有高质量的补丁和低质量的补丁,我希望海龟以一定的概率死亡(由滑块决定),这取决于它们降落的补丁…

如果[calidad]of patch here=“baja”,你可能想要

但是请注意,海龟总是生活在一个补丁上,因此您可以直接引用
补丁自己的
变量作为这种情况的捷径(同样,您也可以在海龟上下文中使用
pcolor
):

to check-if-dead
  if habitat = "escarabajo" [
    ask escarabajos [
      if count escarabajos-here > capacidad-de-carga-bosques [die] ; beetles that reach patches that already have a # above the carrying capacity die 
      if [calidad] of patch-here = "baja" [
        if random 100 > probabilidad-de-supervivencia-calidad-baja [die]
      ]
      if [calidad] of patch-here = "alta" [
        if random 100 > probabilidad-de-supervivencia-calidad-alta [die]
      ]
    ]
  ]
end
to check-if-dead
  if habitat = "escarabajo" [
    ask escarabajos [
      if count escarabajos-here > capacidad-de-carga-bosques [die] ; beetles that reach patches that already have a # above the carrying capacity die 
      if calidad = "baja" [
        if random 100 > probabilidad-de-supervivencia-calidad-baja [die]
      ]
      if calidad = "alta" [
        if random 100 > probabilidad-de-supervivencia-calidad-alta [die]
      ]
    ]
  ]
end