0
我正在建模一個城市景觀,用於觀察運動,其中補丁等同於建築物並具有不同的影響值。我需要使用計算的東西,如每個補丁值的記者函數:netlogo:有補丁使用記者計算影響力值
(its own influence) plus (the influence of neighbors) divided by the
distance to a specific turtle (max-one-of distance myself)
龜然後將朝着具有最高影響值的補丁移動,但沿着街道定義。
我是新使用netlogo並已完全卡住。
我已經包括了我到目前爲止的一部分,但我無法弄清楚如何編寫將計算每個補丁影響值(圓錐體內)的記者函數,以便海龜可以朝着最好的選擇。
to setup-influence-field
ask patches with [pcolor = green] [set influence commercial-influence]
ask patches with [pcolor = orange] [set influence production-influence]
ask patches with [pcolor = yellow] [set influence domestic-influence]
ask patches with [pcolor = pink] [set influence religious-influence]
ask patches with [pcolor = blue] [set influence public-influence]
end
to go
move-serapis
end
to move-serapis
ask serapis [set-procession-heading]
repeat 2 [ ask serapis [ fd .25 ] display ]
tick
end
;;;;; the reporter values are need for this part of the code so that the turtles (serapis) can move towards the patches with the highest influence value;;;;
to set-procession-heading
let direction patches in-cone 4 40 with [influence-field > 0]
if any? influence-field
[face max-one-of influence-field] ;;;; face towards the highest computed influence value
ifelse any? patches with [pcolor = black] in-cone 1 25
[process]
end
任何幫助將不勝感激!