Distribute turtles on patches

ぐ巨炮叔叔 提交于 2019-12-12 02:07:04

问题


 let pop area * density
 distribute-turtles

 to distribute-turtles [ pop box ]
    if (pop > count box) [ error "Box can't hold all turtles!" ]

  ask n-of pop box [sprout-inboxturtles 1[
       set color blue  
       set exit true                ;ignore
       set alpha alpha-exit         ;ignore
       set beta beta-exit           ;ignore
       set size 0.9   
       ]
       ]
end

The above code distributes turtles on patches.

box-patches

pop-number of turtles

I will create turtles such in accordance to the density within the box such that:

a.) no 2 turtles have the same centre, therefore there could more than 2 turtles per patch but shouldn't have the same centre.


回答1:


The turtles already have random headings so if you have them go forward a random float less than .5 they will have unique coordinates.

fd random-float .5

Aesthetically the turtle size should be small enough to see each.

Remember turtles-here will report all turtles on the patch.



来源:https://stackoverflow.com/questions/26575964/distribute-turtles-on-patches

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!