【问题标题】:report a variable from all patches in behavior space netlogo报告来自行为空间 netlogo 中所有补丁的变量
【发布时间】:2015-01-23 10:35:12
【问题描述】:
我在 NetLogo 中有一个模型,可以模拟植物(补丁)上的昆虫(海龟)食草动物。每个补丁都有一个称为资源的变量,每次乌龟访问它时都会耗尽。我想在通过行为空间运行我的模型时报告每个补丁的资源和补丁坐标。
到目前为止我有:
to-report damageToPatches
foreach sort patches [ ask patches [
report resources ]]
end
这显然不起作用,这可能很简单,但我正在努力想出一个解决方案。是否可能涉及在每个时间步将每个补丁的资源值添加到列表中?
【问题讨论】:
标签:
netlogo
behaviorspace
【解决方案1】:
如果我只是对您的代码进行最小的修改以使其运行,我们会得到:
to-report damage-to-patches
report [resources] of patches
end
但你说你也想包含补丁坐标,所以应该是:
to-report damage-to-patches
report [(list pxcor pycor resources)] of patches
end
of 以随机顺序给出结果。如果您希望列表按从左到右、从上到下的顺序排列,那么就是:
to-report damage-to-patches
report map [[(list pxcor pycor resources)] of ?] sort patches
end