如何在netlogo中的函数内调用函数,从而两个函数都将带有多个参数?

问题描述

我想在netlogo中的一个函数调用一个函数,并且两个函数都带有许多参数,我该怎么做?在我甚至尝试使用runresult(来自先前的答案)之前,代码语法给了我很多错误

从本质上讲,代码正在执行正向反应:物种1 +物种2->物种3通过执行以下操作:

要求物种1扫描外围区域以查找物种2,如果找到了,则将onrat(k-on)乘以一个因子(alpha),使物种2死亡并将物种1的品种设置为物种3。现在,第二个函数(set-attributes2)将被称为tos et新物种3的某些属性,这也需要很多参数。我如何:
  1. 在function1(fwd-reaction)内调用function2(集合属性2)
  2. 执行上述操作时
  3. 传递function2的参数(例如)?
to set-attributes2 [ x-occupiedepitopes x-size x-leader x-exempt_from_immobilisation x-aggregated x-color]
  set occupiedepitopes x-occupiedepitopes
  set size x-size
  set leader x-leader
  set aggregated x-aggregated
  set exempt_from_immobilisation x-exempt_from_immobilisation
  set color x-color
end


to fwd-reaction [#asking-species #species-to-scan #x-k_on #x-alpha #species-to-die #new-breed]
  ;let temp-list []
  ;set temp-list (list asking-species species-to-scan x-k_on x-alpha species-to-die new-breed )
  let scanning #species-to-scan
  ask #asking-species [
    if (any? other (#species-to-scan) -here) and random-float 1000 < (#x-k_on * 2 * #x-alpha)
      [
            ask one-of other #species-to-die -here
            [ die ]
            set breed #new-breed
            set-attributes2 0 2 self true false red

          ]
        ]
      
end


现在,该错误表明我在以下代码行的-here之后缺少一个括号:

 if (any? other (#species-to-scan) -here) and random-float 1000 < (#x-k_on * 2 * #x-alpha)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)