我有一个问题,用另一个海龟中性粒细胞(品种)跟踪最近的念珠菌(品种)。坎迪达斯无法移动,中性粒细胞在该区域寻找最近的念珠菌,面对他,向前走去。当世界被包裹的时候,一切都很好。然后中性粒细胞穿过"墙壁",追逐念珠菌。但关键是世界无法包裹。所以我在另一个模型的帮助下创建了condidion,当中性粒细胞达到最大坐标时,它会反弹中性粒细胞。但现在他们不停地从墙上跳下来,不再寻找其他目标。
我将非常感谢你的帮助。
to lookfor ;;if meet candida in near area - chase, if not - continue looking for
ifelse any? candidas [ chase ] [ move ]
end
to chase ;;set the target on the nearest candida, face to them and move one step to him
set nearest-candidas min-one-of candidas [ distance myself ]
face nearest-candidas
bounce fd 1
end
to move
bounce
fd 2
end
to bounce
if abs pxcor = max-pxcor [ set heading (- heading) ] ;; bounce off top and bottom walls
if abs pycor = max-pycor [ set heading (180 - heading) ]
if abs pzcor = max-pzcor [ set heading (- heading) ]
set nearest-candidas max-one-of candidas [ distance myself ]
end
编辑:哦,你在NetLogo 3D中。不幸的是,这改变了一切。如果不能阻止世界的包裹,就没有简单的方法。如果你有冒险精神,你可以试着找到一种方法,通过与世界上其他海龟进行三角测量,确保最近的海龟在"墙的右侧"。虽然这并不容易,但我认为这是可行的。祝你好运
过期回复:我认为问题可能是在你的bounce
程序中,你有
set nearest-candidas max-one-of candidas [ distance myself ]
使用max-one-of
将候选细胞设置为离中性粒细胞最远的一个。您在chase
过程中将其正确设置为min-one-of
(即min之一,而不是max其中之一)。改变这一点会给你带来你所期望的行为吗?