我有一些自己環顧四周的烏龜。對於他們每個鄰居,他們保存了「輸出熱量」的值。具有最高值的貼片將獲得最高概率,並且最低值是最低概率。我希望烏龜移動到另一個補丁。移動應該取決於概率。 我的代碼看起來是這樣,但它不能正常工作像它應該: ask turtles-here[
let temp_ahead [(output-heat + 1)^ Freedom] of patch-at 0 1
let t
我已經創建了一個補丁自己的變量,每次代理登陸一個特定的補丁後,它會增加「1」。 它每下降一點也減少0.1。 到目前爲止的代碼看起來是這樣的 to go-predation-risk
ask patch-here [
set predation-risk predation-risk + 1]
end
to deduct-predation-risk
ask pa
如何製作其他清單的累積金額清單? 我想這樣的說法: ;;all temperatrue-values around the turtle saved in list
set temperature_values (list [(output-heat + 1)^ Freedom] of neighbors)
;;build cumulative value of temperatures
對不起,如果我討厭你,但我的老師說這個代碼[1]不夠好,我應該使用代理集而不是個體值。 代碼[1](第一個代碼工作很不錯) let temp_ahead [(output-heat + 1)^ Freedom] of patch-ahead 1
let temp_right_ahead [(output-heat + 1)^ Freedom] of patch-right-and-ahead 4