该模型的目的是探索落基山脉北部灰狼的潜在扩散模式。在模型中,灰狼被赋予一个ph-memory与空间数据表相对应的属性。
extensions [ gis table csv]
wolves-own [
...
ph-memory ;; wolves' patch-hunting memory, table includes the patch's hash-id (KEY) and pack-id (VALUE)
...
]
to initialize-wolf [ new-pack-id ]
...
set ph-memory table:make
...
end
to setup
clear-all
setup-gis
file-open (word "Ph-memory-for-run-" behaviorspace-run-number ".csv")
...
end
to go
if not any? wolves [stop]
ask wolves [
where-am-i
...
file-write (table:to-list ph-memory)
end
to where-am-i
let patch-hash-id ([hash-id] of patch-here) ;;Updates the hash-id of the patch the wolf …Run Code Online (Sandbox Code Playgroud)