gpt4 book ai didi

netlogo - 在模型设置中禁用世界包装时如何使用基元 "patch-right-and-ahead"?

转载 作者:行者123 更新时间:2023-12-05 01:04:32 26 4
gpt4 key购买 nike

我对原始的“patch-right-and-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 ] ]

在此先感谢您的帮助。

最佳答案

当正常返回代理的原语找不到合适的代理返回时,它将返回 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
]
]

关于netlogo - 在模型设置中禁用世界包装时如何使用基元 "patch-right-and-ahead"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22967983/

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