1

I realize that my question is just slight modification of questions:

but I can't modify them to satisfied my needs.

I need to produce a patchy forest landscape. Each setup, the total area of "green" patches has to be same (20%, 10%... of total count patches) and the size of one blob should be same. Thus: blob_size = area / number_blobs

I suggest that

to create-forests
  clear-all
  ask n-of 1 patches [ set pcolor green ]
  repeat 6 [
    ask one-of patches with [pcolor = green ] [
      ask one-of neighbors4 with [pcolor = black] [ 
        set pcolor green ]
    ]
  ]
end

should be the answer, as by n-of 1 (number_blobs) patches I create number of blobs needed, and blob_size is constrained by repeat 6 (blob_size). However, in my simple example I have an error ASK expected input to be an agent or agentset but got NOBODY instead. apparently because one-of patches with [pcolor = green] has not black neighbors.

Please, how can I include the condition ask one-of patches with [pcolor = green ] and with min-one of neighbors4 with [pcolor = black] in my code? Or what is the different way to do this? I need to keep my total area of green patches same, and patches size +- same too, the best would be if they will not overlap. Thank you a lot!

Community
  • 1
  • 1
maycca
  • 3,848
  • 5
  • 36
  • 67

2 Answers2

1
to create-forests
  clear-all
  ask n-of 1 patches [ set pcolor green ]
  repeat 6 [
    ask one-of patches with [pcolor = green and any? neighbors4 with [ pcolor = black ] ] [
      ask one-of neighbors4 with [pcolor = black] [ 
        set pcolor green ]
    ]
  ]
end
Bryan Head
  • 12,360
  • 5
  • 32
  • 50
  • thank you @BryanHead! Your example produces blobs of different size. I can produce the blobs of same size by just changing it to `ask patches with [pcolor = green and any? neighbors4 with [ pcolor = black ] ] `as you suggested. Please, is there any way how to not let to overlap them? maybe some sort of "halo-effect" among the first "nucleus" patches? – maycca Sep 23 '15 at 18:11
0

Modified to make-blob from: Creating a random shape (blob) of a given area in NetLogo

  • my blobs still can overlap but at least total "area" is the same for every run

    to make-blob
      let total_area 500       ;  how patches I want to turn green
      repeat 5 [               ; number of blobs I want to  have
        let blob-maker nobody
        crt 1 [ set blob-maker self     
           setxy random-xcor random-ycor]  ; set random position of "blob-makers"
        repeat 10 [               ; size of one blob (number of patches of the same color close one to another)
        ask blob-maker [
           ask min-one-of patches with [ pcolor = black ] [ distance myself ] [ set pcolor green ]
      rt random 360
      fd 1
    ]
    ]
    ask blob-maker [ die ]
    ]
    end
    

resulting in

enter image description here

Community
  • 1
  • 1
maycca
  • 3,848
  • 5
  • 36
  • 67