Misc‎ > ‎Behaviours‎ > ‎

create circle

create circle of colour in patches

BehaviourComposer: ignore everything before this.

An agent changes the color of patches within successively smaller circle radii from itself. This is a general approach that can be used to set up the patch environment at the start of a model (you may want to ask this "patch set up agent" to die or to be invisible).

Begin micro-behaviour

create circle of colour in patches

Begin NetLogo code:
substitute-text-area-for center-y 3substitute-text-area-for center-x 2substitute-text-area-for circle-radius 7 substitute-text-area-for perimeter-colour 20substitute-text-area-for c-increment 1substitute-text-area-for r-increment 1let up     center-y ;how far up you want the centerlet across center-x ; how far acrosslet radius circle-radius ; the radius of the circlelet colour perimeter-colour ; the color at the outer perimeterlet colour-increment c-increment ; how much the colour of successive circular fills changelet radius-increment r-increment ; the step inwards towards the agent each repeat cycleset xcor up set ycor across repeat radius [   ask patches in-radius radius [      set pcolor colour       set plabel pcolor ]         set radius ( radius - radius-increment )         set colour ( colour + colour-increment )      ]
End NetLogo code

The image below shows how this micro-behaviour can be used to create circles of patches coloured according to the rules described in the code above (the micro-behaviour is added to a prototype three times and each configured separately, the prototype is made invisible - see thisexample model):

BehaviourComposer: ignore everything after this.