我有一个问题,跟随最近的念珠菌(品种)由另一只海龟-中性粒细胞(品种)。念珠菌无法移动,中性粒细胞在该区域寻找最近的念珠菌,面对他继续前进。当世界被允许包装时,一切都很好。然后中性粒细胞穿过“墙”,追逐念珠菌。但重点是,世界是不能包装的。因此,我在另一个模型的帮助下创建了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
发布于 2016-08-03 09:49:46
编辑:哦,您是在NetLogo 3D中。不幸的是,这改变了一切。如果不能阻止世界的包装,就没有简单的方法来做到这一点。如果你喜欢冒险,你可以尝试通过与世界上其他海龟进行三角测量来确保最近的海龟在“墙的右边”。虽然这并不容易,但我可以看到它是有效的。祝好运。
过时的回答:我认为问题可能是在您的bounce过程中,您有
set nearest-candidas max-one-of candidas [ distance myself ]使用max-one-of将假丝酵母菌设置为离中性粒细胞最远的一种。您可以在将其设置为min-one-of的chase过程中正确地使用它(即min of,而不是max of)。改变这一点会给你带来你所期望的行为吗?
https://stackoverflow.com/questions/38718638
复制相似问题