我在将布尔变量与链接与另一个品种的代理相关联时遇到问题。 但是,我的代码无法正常工作。
turtles-own [manipulated?]
breed [families family]
breed [developers developer]
to setup
clear-all
crt 10
[
set breed families
]
crt 5 [
set breed developers
]
ask turtles [
create-link-with one-of other turtles
let manipulable link-neighbors with [ breed = developers]
ifelse manipulable [set manipulated? TRUE] [set manipulated? FALSE]
]
reset-ticks
end
答案 0 :(得分:1)
我不是100%知道您要做什么?您是否要让与开发人员链接的乌龟将其manipulated?
值设置为true?如果是这样,也许类似的方法会起作用-尝试将您的ifelse manipulable...
语句替换为:
set manipulated? ifelse-value any? manipulable [ true ] [ false ]
如果这不是您要找的东西,您可以详细一点吗?
编辑:根据Seth Tisue的评论,上面的代码可以改进为:
set manipulated? any? manipulable