title: NetLogo: Calculate turtles' offsprings on patches (by sprout function?)
body: <p>On my NetLogo world surface, I would like to count the number of turtles on pink patches. Next, I want to include the reproduction process. More specifically <strong>I want to multiply number of turtles on these patches by number of offspring per turtle (3) and thus create new turtles.</strong> The offspring should have the quality of their parents. </p>
  
  <p>In steps: 
  1. create 100 turtles on pink patches (parents)
  2. identify number of turtles per pink patch (I want to incorporate this model into bigger one) and multiply it by 3 -> 100 parents have 300 offspring
  3. let parents die, keep only offspring
  4. resulting number of turtle per pink patch: 300</p>
  
  <p>It seems the use of <code>sprout</code> could be adequate to produce turtles on each pink patch. However I don't understand how can I include this offspring creation? I know that I can count number of turtles per patch by </p>
  
  <blockquote>
    <p>show [count turtles-here] of patches with [pcolor = pink]</p>
  </blockquote>
  
  <p>but how to include this information in my new turtles (offspring) creation? and how to "copy" quality of their parents? (being red?)</p>
  
  <p>I tried to incorporate answer published here but without success: <a href="https://stackoverflow.com/questions/21101942/sprouting-turtles-in-netlogo-based-on-patch-value">Sprouting turtles in NetLogo based on patch value</a></p>
  
  <p>Thank you a lot, here is my code:</p>
  
  <pre><code>to setup
    clear-all
    setup-patches
    setup-turtles
    reset-ticks
  end
  
  ; create diverse landscape
  to setup-patches
    ask n-of 5 patches [ set pcolor pink ]
  end
  
  ; create turtles on pink patches
  
  to setup-turtles 
    ask patches with [pcolor = pink] [sprout 100 [ set color red ]]   
    ; ask patches with [pcolor = pink] [count turtles-here]
    ; show [count turtles-here] of patches with [pcolor = pink]        ; calculate number of turtles on every pink patch
    let patch-list [count turtles-here] of patches with [pcolor = pink] 
    let i 0
    foreach patch-list [
      ask ? [
        sprout item i patch-list
        set plabel count turtles-here
      ]
      set i i + 1
    ]
    reset-ticks
  end
  </code></pre>