NetLogo 6 和 rnd 扩展
NetLogo 6 and the rnd extension
我正在尝试将我的模型更新到 NL 6,因为自动更新失败(主要是由于匿名过程的语法)。我的模型使用 rnd 扩展,它现在显然与 NetLogo 捆绑在一起,但是来自 the manual 的示例仍然提到了这一点:
extensions[rnd]
to go
let pairs [ [ "A" 0.2 ] [ "B" 0.8 ] ]
repeat 25 [
; report the first item of the pair selected using
; the second item (i.e., `last ?`) as the weight
type first rnd:weighted-one-of-list pairs [ last ? ]
]
end
这会导致错误,因为 "nothing named ? has been defined"。我已经能够转换其他东西,如 foreach 和 n-values,但我正在努力将此示例转换为 NetLogo 6 所需的新符号。有人可以帮忙吗?
我们在转换 rnd
扩展手册以将其与 NetLogo 捆绑时遗漏了一些案例。这将在 NetLogo 6.0.1 中修复。同时,您可以参考GitHub:
上最新版本的手册
https://github.com/NetLogo/Rnd-Extension/blob/hexy/README.md
在您的特定情况下,NetLogo 6 语法为:
rnd:weighted-one-of-list pairs [ [p] -> last p ]
我正在尝试将我的模型更新到 NL 6,因为自动更新失败(主要是由于匿名过程的语法)。我的模型使用 rnd 扩展,它现在显然与 NetLogo 捆绑在一起,但是来自 the manual 的示例仍然提到了这一点:
extensions[rnd]
to go
let pairs [ [ "A" 0.2 ] [ "B" 0.8 ] ]
repeat 25 [
; report the first item of the pair selected using
; the second item (i.e., `last ?`) as the weight
type first rnd:weighted-one-of-list pairs [ last ? ]
]
end
这会导致错误,因为 "nothing named ? has been defined"。我已经能够转换其他东西,如 foreach 和 n-values,但我正在努力将此示例转换为 NetLogo 6 所需的新符号。有人可以帮忙吗?
我们在转换 rnd
扩展手册以将其与 NetLogo 捆绑时遗漏了一些案例。这将在 NetLogo 6.0.1 中修复。同时,您可以参考GitHub:
https://github.com/NetLogo/Rnd-Extension/blob/hexy/README.md
在您的特定情况下,NetLogo 6 语法为:
rnd:weighted-one-of-list pairs [ [p] -> last p ]