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 3
substitute-text-area-for center-x 2
substitute-text-area-for circle-radius 7 
substitute-text-area-for perimeter-colour 20
substitute-text-area-for c-increment 1
substitute-text-area-for r-increment 1
let up     center-y ;how far up you want the center
let across center-x ; how far across
let radius circle-radius ; the radius of the circle
let colour perimeter-colour ; the color at the outer perimeter
let colour-increment c-increment ; how much the colour of successive circular fills change
let radius-increment r-increment ; the step inwards towards the agent each repeat cycle
set 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.