Polygonal Virtual Grids for CA Computing: Pentagonal, Hexagonal, and Octagonal Samplers

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

This Demonstration was motivated by a desire to circumvent the difficulty of constructing large arbitrary polygonal grids for use in cellular automata (CA) computing. Thus the goal of the Demonstration is threefold: (1) to show that given any desired grid-wide polygonal cell cluster shape (trigonal, rectangular, pentagonal, hexagonal, etc.) for use in CA computing, it is not necessary to a priori construct a starting grid that is populated with these polygonal cell clusters in order for the computation to meet its objective—rather, in concert with the right computing strategy, a CA neighborhood in the shape of the desired polygonal cell cluster shape achieves the same effect by way of a virtual grid; (2) to show that in light of (1), the starting grid size is limited only by acceptable computing speeds and can have the simplest possible shape; (3) to test the viability of (1) and (2) with a CA computation; here snowflake growth on a virtual hexagonal grid is shown to meet objective (3)—watch for enfolded growth in the direction of the six vertices (see thumbnail) as determined by the center of the hexagon and its vertices (see first snapshot; cf. second and third snapshots that show pentagonal and octagonal neighborhood vertices, respectively).


The methodology employed in this Demonstration could readily be extended to three-dimensional problems that call for polyhedral neighborhoods (where system-space can be a cube), and could otherwise be modified to let one engage single-body problems (car crashes, plate tectonics, etc., where multiple "localnhdAs" and whole-neighborhood updating is an effective approach).


Contributed by: Michael Dewus (April 2014)
Open content licensed under CC BY-NC-SA



In keeping with objective (3) of the caption, the particular computation in view is snowflake growth; it is performed by a search-update-feedback cellular automaton (SCA). Please see "buildcrystal" in section 1B of the code for an explanation of the SCA's rules.

With respect to grid cell units, the oblique side lengths of the hexagon, which follow "localnhdA6" (see section 3 of the code), have length 3.61 units (nearest cell spacing of 3 horizontal and 2 vertical), and the non-oblique sides have length 3.00 units (see first snapshot).

Largely for comparison purposes, the control "polygon sides" offers other polygon neighborhood shapes by which to compute via a virtual grid (sides 5 is a pentagonal neighborhood and sides 8 is an octagonal neighborhood); for convenience these other neighborhoods are used with the same snowflake rules as used to meet objective (3) of the caption, and so this output per se is less meaningful (besides fidelity to polygon shape in the output). Computation with these other neighborhoods is mainly intended to show a virtual grid in action in other settings.

Use the control "polygonal initial condition" to switch between an initial condition that uses all of the given polygon's neighborhood vertices (set control true/check) and one that uses only the neighborhood's active cell vertex (set control false/uncheck). Use the "reset" control to make general initial condition changes or to abort and restart before autocycling completes. Compare the rules by toggling "heat survivor rule." Use the "autocycle" control to turn autocycling on and off (low faceting can cause early autocycling reset, and so you may wish to turn autocycling off before starting an extended analysis; with autocycling turned off use the reset control to abort and restart); toggle "autocycle" at any time. Use the "faceting" slider to control the amount of faceting allowed (see "buldcrystal" in section 1B of the code for an explanation of how "faceting" and "heat survivor rule" are implemented). You will notice that the liquid background color tracks the value of "faceting."

Observations besides the virtual grid effect:

(1) As the number of neighborhood vertices increase, so does the tendency for the appearance of curvilinear structure both internally and at the boundary; curvature is further influenced by the rule and recursion (recursion, as the "digital derivative," always forces curvature to some degree).

(2) The convolutions of feedback seem to catalyze an interference-pattern-type-behavior (loosely defined) first largely at the vertices; sufficient "constructive interference" possibly gives rise to protuberances, which either separate or further convolute and so define the boundary in a manner consistent with the polygon. In this way the polygon continuously reshapes itself—this behavior appears to be cyclic, and persists as polygon area increases; it manifests with either rule, irrespective of the "faceting" sweep frequency, and irrespective of polygon shape; it is best observed with the larger grid sizes. Apparently because of this behavior, artificially driven by the SCA, the initial condition always ends up being exactly what it is supposed to be—a polygon of some given shape, though the path that leads there is a chaotic one. Here that endpoint polygonal shape jibes with (hexagonal) crystal structure.


[1] NKS Online. "Growth of Crystals." www.wolframscience.com/nksonline/section-8.2-text (NKS|Online).

[2] Wolfram|Alpha. www.wolframalpha.com.

[3] Wikipedia. "Nucleation." (Apr 22, 2014) en.wikipedia.org/wiki/Nucleation.

[4] Wikipedia. "Snowflake." (Apr 22, 2014) en.wikipedia.org/wiki/Snowflake.

[5] Wikipedia. "Feedback." (Apr 22, 2014)en.wikipedia.org/wiki/Feedback.

[6] Wikipedia. "Ice." (Apr 22, 2014)en.wikipedia.org/wiki/Ice_formation.

[7] Wikipedia. "Humidity." (Apr 22, 2014) en.wikipedia.org/wiki/Humidity.

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.