Sprouting turtles in NetLogo based on patch value

前端 未结 1 1681
[愿得一人]
[愿得一人] 2021-01-27 05:01

I have loaded an ASCII file in NetLogo with values (ranging from 0 - 4.6) that represent the mean number (of a Poisson process) of turtles inhabiting the patch. I\'d like to se

相关标签:
1条回答
  • 2021-01-27 05:49

    If your problem is asking all patches you can use following:

    to setup 
      clear-all
      resize-world 0 10 0 10
      set-patch-size 40
      let ASCII-file-Values   n-values 121 [ random-poisson mean n-values 121[random-float 4.6]]
      let patches_list sort patches
    
    
      let i 0 
      foreach patches_list [
        ask ? [
    
          sprout item i ASCII-file-Values  
          set plabel count turtles-here
        ]
        set i i + 1
      ]
    
      reset-ticks      
    end
    

    The only section which answers your question is the foreach patches_list [] If you need values assigned to the patches to be used later, another way could be adding a varible to each patch and set this value in the foreach loop, then you can ask patches [ sprout my-value]

    enter image description here

    0 讨论(0)
提交回复
热议问题