NetLogo banner

 Home
 Download
 Resources
 Extensions
 FAQ
 References
 Contact Us

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Japanese

  Donate

NetLogo Models Library:
Sample Models/Computer Science

(back to the library)

Hex Cell Aggregation

[screen shot]

If you download the NetLogo application, this model is included. (You can also run this model in your browser, but we don't recommend it; details here.)

## WHAT IS IT?

This is a model of growth. It takes place on a two-dimensional hexagonal grid of cells. Cells can either be alive or dead. Various growth patterns result, depending on the exact rules governing growth.

## HOW IT WORKS

SETUP arranges cells in a hexagonal grid, as in Hex Cells Example. The edges of the grid do not wrap.

Only the center cell is alive at the start.

The switches determine which dead cells are eligible to become alive. For example, if the ONE-NEIGHBOR? switch is on, dead cells that have exactly one alive neighbor are eligible for growth, and so on for the rest of the switches.

Each tick, one eligible dead cell goes live.

Dead cells are invisible (black). Live cells are shown in orange or red depending on whether they have any dead neighbors.

## HOW TO USE IT

SETUP places one alive cell in the middle of the grid.

GO advances the growth process.

X-NEIGHBORS? are switches that, when on, allow new cells to grow where they will have X alive neighbors. X ranges from one to six because the cells are on a hexagonal grid and so each cell has 6 neighbors.

READ-SWITCHES makes your settings for the switches take effect. (They don't take effect right away because the model is coded in a special way in order to run faster.)

## THINGS TO NOTICE

When some switches are turned off, "holes" appear in the pattern. Depending on which X-NEIGHBORS? switches are on and which are off, those holes can be different shapes. Some interesting configurations are {1, 2, 4} (ONE-NEIGHBOR?, TWO-NEIGHBORS?, AND FOUR-NEIGHBORS? on while all other switches are off), {1}, {1, 4, 5}, {1, 3, 5, 6}, and {1, 3, 4, 5, 6}.

Often, as the alive cells approach the border, the overall shape resembles a circle.

For different configurations of the X-NEIGHBORS? switches, the "Cell Types" plot shows very different numbers of alive, dead, and inner-edge cells when the model stops.

## THINGS TO TRY

Change the size of the world. If it's much bigger, the model might run too slowly. If it's smaller, can you get different patterns?

Switch off TWO-NEIGHBORS? for a run. Does the overall shape look any different? After the model has been running for a while, change the switches to not allow 1 or 2 neighbors while allowing for 3 and up. (Don't forget to press the CHANGE-SWITCHES button.) Watch it go. What happens if you then change it to allow only for 1 or 2?

## EXTENDING THE MODEL

Implement the model on a regular square grid using both `neighbors4` and `neighbors` instead of the `neighbors6` we used in this model. Figure out a way to measure how quickly the alive cells spread to the edge in different configurations.

To better see the near-circular shape of the aggregation as the growth gets near the edge, add a check that stops the model when a cell on the edge becomes alive.

Add a plot that tracks the ratio of orange to red cells.

Each tick one eligible dead cell goes live. This one-at-a-time update rule differs from many cell-based models which update all the cells at once. (This update rule is specified in the reference in the CREDITS AND REFERENCES section.) Change the rules so that each tick, all of the eligible dead cells go live. What different result do you observe, if any?

## NETLOGO FEATURES

The code uses lists in order to make the model run faster. The code would be considerably simpler if these lists weren't used, but it would also run much slower. See the comments in the Code tab for details on the use of lists in this model.

## RELATED MODELS

Diffusion Limited Aggregation
Life
Hex Cells Example

## CREDITS AND REFERENCES

This model was inspired by Stephen Wolfram's A New Kind of Science. A very similar model is discussed here: https://www.wolframscience.com/nksonline/page-331. In the notes at the end of the book, many extensions are suggested, although none on a hexagonal grid.

Thanks to Josh Unterman and Seth Tisue for their work on this model.

## HOW TO CITE

If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

* Wilensky, U. (2007). NetLogo Hex Cell Aggregation model. http://ccl.northwestern.edu/netlogo/models/HexCellAggregation. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

Please cite the NetLogo software as:

* Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

## COPYRIGHT AND LICENSE

Copyright 2007 Uri Wilensky.

![CC BY-NC-SA 3.0](http://ccl.northwestern.edu/images/creativecommons/byncsa.png)

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

(back to the NetLogo Models Library)