在Netlogo 3D中随机游走弹跳例程

时间:2018-10-03 15:33:59

标签: netlogo

我在用Netlogo随机游走编写弹跳例程时遇到了麻烦。我想让代理在单向电流中随机游走(此位的代码不正确,但它是一个功能占位符)。我还需要防止代理进入以RGB pcolor表示的海底特征。这是我的努力:

to move-resources
ask resources [
right random 45
left random 45
tilt-up random 45
tilt-down random 45
fd 1
;;; simulated current in one direction:
set heading 90
set pitch 0
set roll 0
fd 1
while [ any? patches in-radius 1 with [ pcolor = [218 160 62]] ]  [
let nearest-patch min-one-of (patches with [pcolor = [218 160 62]])[distance 
myself] ;;; find the closest sandy patch
face nearest-patch ;; face that patch
set heading heading - 180 ;; face away from that patch
fd 1 ;; move away from that patch
]
]
end

1 个答案:

答案 0 :(得分:1)

道歉遗漏了一个小错误,但我的问题只是使用:

set heading heading - 180

在3D模式下,我应该使用(用于水平方向的海床):

set pitch pitch - 180