在我的模型中,我將海龜從地圖的右側移動到左側。當他們旅行時,他們正在尋找綠色的補丁。當他們發現一個並且處於他們的視野中時,他們轉過頭來朝向它。如果有多個等距離的補丁,他們隨機選擇哪一個去。然而,當他們移動時,他們的移動似乎有很多不必要的抖動。任何人都可以說出原因?看這張圖片http://imgur.com/qOftVPJ。他們應該直行直到看到綠色。如何在Netlogo中進行每次移動後更改海龜標題?
to move-bug
ask bugs [
count-steps
if pxcor = min-pxcor [
file-open data-filename
file-type data-filename
file-type " "
file-type data-header
file-write vision-width
file-write vision-distance
file-write greenroof-percent
file-write gray-steps
file-write green-steps
file-write steps
file-type "\n"
file-close
]
if pxcor = min-pxcor [die]
set heading 270
pen-down
let green_target nobody
let perceived_patches patches in-cone vision-distance vision-width
set green_target perceived_patches with [ pcolor = green ]
ifelse count green_target > 0 [face min-one-of green_target [vision- distance]][face min-one-of perceived_patches [vision-distance]] ;; added equivalent jitter to non-green squares
前進1 ]
end
非常感謝! – Shane
不客氣! –