Using neighbour counts to control growth

Introducing neighbour counts

I am now tracking and visualising neighbour counts for all cells, and have updated neighbour count to be complete for all 12 adjacent cells - ie 3 that share edges and 9 that share corners. I hope this will be useful for more refined control.

As the total number of cells (rows x cols) is known during setup, I have also swapped arraylists for a simpler 2d array, which makes calling cells at particular locations a little more succinct.

The following set are 9 cell shapes from the same random grow function of the previous post. Shading is based on count.

 


In this set gap checking has been updated to use the revised neighbour count. Gaps, highlighted in green, are identified when the neighbour count is greater than 3. The shapes are 19 cells.



Now in this set I have added a second neighbourcount which only counts neighbours that share edges. In this set a gap is highlighted when a cell has a neighbour count of 2 or 3. The shapes are still 19 cells.


Growing with neighbour count

Now I am able to use neighbour count as a tool to control growth. In the following set a start shape is established with 19 cells using the same random grow function, and then subsequent growth is to cells with the highest neighbour count. In this case the first highest counting left to right and top to bottom if there are multiple cells with the same count.

The following shows a start shape and the following first 5 growth steps (currently, to easily see how growth is working, each step is on mouse click). Gaps are highlighted as above if a cell has a neighbour with shared edges count of 2 or 3.





The following has been grown using only neighbour counts - ie from just one cell, not with a start shape - and creating holey forms there is a maximum count (2) of neighbours with shared edges for the cell to be grown into (subsequent growth in adjacent cells may later increase the count).

Also the cell to grow into is now picked randomly from a list of potential cells to grow into (those with the highest neighbour count and meeting any other conditions such as the maximum count of neighbours with shared edges).



In this set the cell to grow into is determined by the count of neighbours with shared edges. The maximum count of neighbours with shared edges is again 2.



Finally, this set is grown automatically in time steps to a total of x cells (15). As above the cell to grow into is determined by the count of neighbours with shared edges and the maximum count of neighbours with shared edges is 2.


Growing shapes

A different strategy - growing shapes. This is essentially an on-lattice Eden Growth Model. Starting with a single cell on, a random cell that is already on is selected to try to grow from. Growth is attempted to a random adjacent cell that shares an edge. If that cell is already on, then growth is blocked.

Growth is attempted 70 times. Hence the following series of shapes are made from varying numbers of cells.


A more exact growth outcome. In the following series attempts at growth are continued until the number of desired on cells is reached (15).