BehaviourComposer: ignore everything before this. Begin micro-behaviour Begin description: Lay out a set of agents where the agents repel each other and the links between them act like springs.End description Lay out linked agents Begin NetLogo code:substitute-text-area-for repetitions 500substitute-text-area-for nodes-to-layout all-individualssubstitute-text-area-for links-in-layout links substitute-text-area-for spring-constant .2 substitute-text-area-for spring-length 5 substitute-text-area-for repulsion-constant 1 substitute-text-area-for setup-code ; place for code to set things up (if needed)no-displaysetup-coderepeat repetitions[layout-spring nodes-to-layout links-in-layout spring-constant ; a measure of the "tautness" of the spring spring-length ; the "zero-force" length or the natural length of the springs repulsion-constant] ; a measure of repulsion between the nodesdisplayEnd NetLogo code VariantsAll the text areas can be edited. If you want to limit the agents involved edit the first box. E.g. To only layout sheep replace it with Related Micro-behavioursHow this worksThis uses the NetLogo layout-spring primitive to place the agents. It repeats calls to layout-spring since each time the constraints are solved bringing the configuration of agents closer to the ideal solution. HistoryLay out linked agents was implemented by Ken Kahn on 1 February 2011. BehaviourComposer: ignore everything after this. |