【发布时间】:2017-03-31 00:42:54
【问题描述】:
我正在创建一个关于动物园的 Netlogo 模型。我需要我的动物园客人(多只海龟)沿着从动物园入口处开始的圆形路径每 24 次(在我的模型中 1 次为 1 小时)。它必须在容纳动物的笼子周围移动,因为我不能让我的客人进入动物区。路径不一定要快或最短,我只需要乌龟不要偏离它。我宁愿不使用 GIS 来创建路径。
我的世界的尺寸在两个方向上都是 -30 到 30 并且不会环绕。
笼子的下落描述如下:
patches-own [ tigerhabitat?
flamingohabitat?
monkeyhabitat?
hippohabitat?
giraffehabitat?
]
to create-habitats
ask patches with [ pxcor < -12 and pycor > 23 ]
[ set tigerhabitat? true
set pcolor green ]
ask patches with [ pxcor > 20 and pycor > 20 ]
[ set hippohabitat? true
set pcolor blue ]
ask patches with [ pxcor > 18 and pycor < 15 and -1 < pycor ]
[ set flamingohabitat? true
set pcolor 96 ]
ask patches with [ pxcor > -10 and pxcor < 10 and pycor < 10 and -10 < pycor ]
[ set monkeyhabitat? true
set pcolor green ]
ask patches with [ pxcor < -12 and pycor < -20 ]
[ set giraffehabitat? true
set pcolor 67 ]
end
【问题讨论】:
-
客人只需要沿路径移动一个方向吗?
-
他们可以向一个方向移动(向前)。
-
您希望他们遵循的路径在哪里?当我
create-habitats时,我确实看到了笼子;您能否详细说明您尝试过的内容以及为什么它没有按照您的意愿进行操作?如果您只需要知道从哪里开始,也许可以查看模型库中包含的一些模型。例如,Surface Walking 2D、Wall Follow 示例或 Look Ahead 模型。 -
我不知道如何让我的龟品种之一,动物园的客人,不要进笼子。我没有尝试过任何事情,因为我不知道该怎么做。也许为动物园的客人制定一条严格的路径,绕着笼子走。