I my model I have several version of how my world should look like. I implemented this as "chooser" including choices: "single_tree" "clustered". My world is 501 * 501 patches.
When I run setup
of my both variations, they are not created until I press Tools -> "Halt".
I don't really understand why because on my working model this works fine. Also when I run this "world variations" with basic paramaters - just with [set pcolor ...].
Please what can be bad in my model or what am I doing wrong?
here is the working example - works fine:
to setup-patches ; define patchy landscape
ask patches [
; Single tree
; -------------------------
if world = "single_tree" [
set pcolor green
]
; Clustered trees
; -------------------------
if world = "clustered" [
set pcolor red
]
end
here is little bit more complicated code but I don't see any reason for taking so long time for dispaying..
to setup-patches ; define patchy landscape
ask patches [
; Single tree
; -------------------------
if world = "single_tree" [
ask patches with [pxcor mod 50 = 0 and pycor mod 50 = 0] [
set pcolor red
]
]
; Clustered trees
; -------------------------
if world = "clustered" [
ask patch 0 0 [
ask patches in-radius (2.99 * Grid) with [pxcor mod Grid = 0 and pycor mod Grid = 0] [
set pcolor red
]
]
; ; determine cluster size
ask patches with [pcolor = red] [
ask patches in-radius radius [
set pcolor yellow
]
]
]
end
I really appreciate any suggestions and thank you a lot !
My problem was that I used too many times "ask patches
" to "ask patches
" to do something...
the fixed code is here - with ask patches
only once per if
statement:
to setup-patches
if world = "single_tree" [
ask patches with [pxcor mod 50 = 0 and pycor mod 50 = 0] [
set pcolor red
]
]
if world = "clustered" [
ask patch 0 0 [ ask patches in-radius (2.99 * Grid) with [pxcor mod Grid = 0 and pycor mod Grid = 0] [
set pcolor red
]
]
ask patches with [pcolor = red] [
ask patches in-radius 5 [
set pcolor yellow
]
]
]
end