我對Netlogo非常陌生,這是我在論壇中的第一篇文章。 我需要創建在棲息地或領土上移動的動物代理組。領土可以重疊。更確切地說,我需要在不同地區活動的男性特務和在其他地區活動的幾組女性特務。如何在netlogo中爲幾組代理創建區域?
這是我到目前爲止所做的。我爲一組女性和一組男性創造了一個領土。那不完全是我需要的。
globals [fragments]
breed [preys prey]
breed [femaletigers femaletiger]
breed [kids kid]
breed [maletigers maletiger]
turtles-own
[
energy
age
gender
territory
]
to setup
clear-all
setup-fragments
;setup-habitats
setup-turtles
reset-ticks
end
to setup-fragments
ask patches[set pcolor 67]
repeat 50
[
ask one-of patches
[
set pcolor brown
repeat 30
[
let a random 360
let b random 5
ask patch-at-heading-and-distance a b
[
ask neighbors [ set pcolor brown]
set pcolor brown
]
]
]
]
end
to setup-turtles
set-default-shape femaletigers "default" ; default shape (dreieck)
create-femaletigers 10
[
set color red
set size 1.5
set energy 100
set age random 20
set gender "female"
set territory patches-in-territory patch 10 6 15
move-to one-of territory with [pcolor = 67 ] ; tigers start in territory but not on fragmented areas
]
set-default-shape maletigers "default" ; default shape (dreieck)
create-maletigers 10
[
set color blue
set size 1.5
set energy random 100
set age random 20
set gender "male"
set territory patches-in-territory patch 40 15 10
move-to one-of territory with [pcolor = 67 ] ; tigers start in territory but not on fragmented areas
]
set-default-shape preys "circle"
create-preys 100
[
move-to one-of patches with [pcolor = 67] ;preys don't start in fragmented areas
set color 114
set size 0.75
]
end
to-report patches-in-territory [Center rd]
let ptr []
ask Center [set ptr patches in-radius 20]
report ptr
end
我很感激任何幫助。 Maria
非常感謝。迄今爲止,這幫助很大。 但是現在女性用戶在他們的領土上移動爲「一個單位」。我需要他們在他們的領土上隨意移動。 –
你的意思是你的模型還是我的例子?在我的例子中,'femaletigers'爲我獨立移動。 –
好的,這是我的模型中的一個錯誤,我可以修復它。謝謝。 –