我对原语“patch-right-ahead-ahead”有疑问。在模型设置中禁用世界包装时,我收到以下错误消息:
OF expected input to be a turtle agentset or patch agentset or turtle or patch but got NOBODY instead.
当我这样做时:
if [pcolor] of patch-here = brown [
if [pcolor] of (patch-right-and-ahead 90 1) = brown [
move-to patch-right-and-ahead 90 1 ] ]
提前感谢您的帮助。
答案 0 :(得分:5)
当通常返回代理的原语无法找到要返回的适当代理时,它将返回nobody
。在这里,没有补丁在当前代理的正前方(呃,因为角度是90,我猜对了)。因此,它正在返回nobody
。在使用nobody
之前,您需要检查以确保它不是of
:
if [pcolor] of patch-here = brown [
let target-patch patch-right-and-ahead 90 1
if target-patch != nobody and [pcolor] of target-patch = brown [
move-to target-patch
]
]