Distribute turtles on patches

2019-09-10 03:55发布

问题:

 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.



标签: netlogo agent