The torus property of the Grid class allows you to choose if the grid boundaries are
linked, but setting them to false may give artifacts if not done properly. Cells will
stick to the border because at the border, they have fewer neighbors to get adhesion and/or
perimeter constraint penalties from. To avoid this, it is best to add a border of
barrier pixels to the edges of the grid. This forbids cells from copying in to the
outermost pixels, and allows you to specify the adhesion with the border specifically.
In this example, the border is made repellant by setting its adhesive penalty
with the cell much higher than that of the background.
Note that this would also work when you do not set the torus property to false, since the
barrier layer prevents the cells from crossing the grid borders. However, changing the
torus setting is important for some internal computations (such as computing centroids).
Especially if the grid is small (as it is here in the y dimension), these computations
can go wrong if torus is not properly specified. It is therefore best practice to always
set torus to false if cells cannot cross the grid border.