BehaviourComposer: ignore everything before this.
Begin micro-behaviour:
Begin description: Place a set of agents in a rectangular grid. End description
Grid layout
Begin NetLogo code:
substitute-text-area-for upper-left-x min-pxcor substitute-text-area-for upper-left-y min-pycor substitute-text-area-for grid-width world-width substitute-text-area-for grid-height world-height substitute-text-area-for agents-to-lay-out-in-a-grid all-individuals layout-grid agents-to-lay-out-in-a-grid upper-left-x ; upper left x upper-left-y ; upper left y grid-width ; width grid-height ; height
End NetLogo code
To change the location of the grid of agents change the upper left x and y. To make a grid of a different size edit the width and height. If you want separate rectangles for different kinds of agents, e.g. "Sheep" then fill the first text area with all-of-kind "Sheep".
This uses the Modelling4All NetLogo layout-grid command to place the agents in a rectangle.
The three-dimensional version of this is Lay out rectangular prism.
Other layouts are supported by Lay out circle and Lay out linked agents.
Grid layout was implemented by Ken Kahn on 10 November 2009.
BehaviourComposer: ignore everything after this.