NetLogo 6和rnd扩展
我正在尝试将模型更新为NL 6,因为自动更新失败(主要是由于匿名过程的语法)。我的模型使用了rnd扩展,现在它显然与NetLogo捆绑在一起,但中的示例仍然提到:NetLogo 6和rnd扩展,netlogo,Netlogo,我正在尝试将模型更新为NL 6,因为自动更新失败(主要是由于匿名过程的语法)。我的模型使用了rnd扩展,现在它显然与NetLogo捆绑在一起,但中的示例仍然提到: 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
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
这会导致错误,因为“未定义任何名称”。我已经能够转换其他东西,比如foreach和n值,但是我正在努力将这个示例转换为NetLogo 6所要求的新符号。有人能帮忙吗?我们在将
rnd
扩展手册与NetLogo捆绑在一起时错过了几个案例。这将在NetLogo 6.0.1中修复。同时,您可以参考GitHub上最新版本的手册:
在您的特定情况下,NetLogo 6语法为:
rnd:weighted-one-of-list pairs [ [p] -> last p ]
非常感谢,尼古拉斯。