gpt4 book ai didi

syntax-error - NetLogo-沙堆-错误

转载 作者:行者123 更新时间:2023-12-03 08:21:57 25 4
gpt4 key购买 nike

如果有代码,我将用这部分追尾。纠正了一个错误(借助stakoverflow)之后,我现在得到了另一个错误。该错误报告“TASK预期有1个输入,一个报告程序或任务命令”,并突出显示了“任务”一词。我不确定是否与括号有关?

;; The density of patches to be set with a random value is set using variable init-errors on interface.
;; Every patch uses a task which reports a random value.
;; The random value is set using variable error-count on interface
to setup-random
ask patches [
if (random-float 100.0) < init-errors
[ setup task ] [ random error-count ]

最佳答案

我认为您只需要setup task [ random error-count ],这样就可以将报告程序块[ random error-count ]传递给task。所以整个事情看起来像:

to setup-random
ask patches [
if (random-float 100.0) < init-errors
[ setup task [ random error-count ] ]

上面假设 setup是可由补丁运行的过程。如果这实际上只是对models库中sandpile模型的修改,那么您可能需要:
to setup-random
setup task [
ifelse-value (random-float 100.0 < init-errors) [
random error-count
] [
0 ;; Or whatever you want your non-"error" patches to get.
]
]

关于syntax-error - NetLogo-沙堆-错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29385209/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com