NetLogo banner

 Home
 Download
 Help
 Resources
 Extensions
 FAQ
 References
 Contact Us
 Donate

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Japanese

  Donate

NetLogo Models Library:
Sample Models/Computer Science

(back to the library)

SmoothLife

[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 model attempts to create Game of Life-like dynamics in a continuous domain. It is recommended that you be familiar with the Life model (in the models library) before looking at this one. As a reminder, in the Game of Life, each patch can either be alive or dead. Patches then update each tick as follows:

  • If I am alive and I have 2 or 3 living neighbors, I stay alive.
  • If I am dead and I have exactly 3 living neighbors, I become alive.
  • Otherwise, I become dead.

These simple rules then lead to a remarkable diversity of emergent structures: shapes that fly across the world, shapes that produce streams of other shapes, and so forth.

The Game of Life is discrete in three ways:

  • Patches are discrete cells in a grid.
  • Patches have discrete states: alive or dead.
  • Patches update at discrete steps in time, rather than fluctuating continuously over time.

Coming up with a continuous model that produces the rich emergent structures of the Game of Life is quite difficult. First, there are many more possible sets of rules for continuous models, and only a relatively small number are likely to produce interesting behavior. Second, continuous models are much more difficult to reason about, so it becomes harder to know which sets of rules are worth exploring.

In SmoothLife, the first two discrete ways become continuous. The system is spatially continuous in that every point in a continuous plane has as real-valued state between 0 and 1. There exists a circular "cell" of a particular radius at every point. The state of the cell is the mean of the values of the points within that cell. The neighborhood of each cell is a donut around that cell, and the state the neighborhood is the mean of the values of the points in the neighborhood. Thus, the cells and neighborhoods of the system also have continuous states. The system may also be made continuous in time, meaning that rather than updating its state in discrete steps, the system changes smoothly through time. However, this third way of making the discrete continuous is not done here. Of course, simulating a continuous plane is impossible. Instead, we approximate this plane with a discrete grid.

Points change value over time by updating based on the relationship between their cell's state and their neighborhood's state. This is roughly analogous with the Game of Life in that over or underpopulation can kill a cell, while being "just right" can give birth to a new cell.

From these rules, clear gliders (like in the Game of Life) and other structures form. Furthermore, the structures that form have a much more organic appearance than in the original Life model.

See this YouTube playlist for many videos of SmoothLife and related models by the original creator.

HOW IT WORKS

Each patch has a number between 0 and 1 associated with it. The state of the cell centered at each patch (with a radius OUTER-RADIUS / RADIUS-RATIO) is the mean of the values of patches inside that cell. The neighborhood of the cell is the donut of patches between OUTER-RADIUS / RADIUS-RATIO and OUTER-RADIUS of the center patch. The state of the cell's neighborhood is the mean of the values of the patches in the neighborhood.

A patch updates its value based on the state of the cell centered on it and the neighborhood of that cell. This update function is similar to the one in Life, except that it's fuzzy: when the state of the cell and neighborhood have the cell on the border between life and death, the patch takes on a value in the middle of 0 and 1. Intuitively:

  • If the inner state of a patch is closer to 0, the patch will become alive (get closer to 1) if its neighborhood state is between MIN-BIRTH and MAX-BIRTH.
  • If the inner state of a patch is closer to 1, the patch will stay alive (remain close to 1) if its neighborhood state is between MIN-STAY-ALIVE and MAX-STAY-ALIVE. Otherwise it will die (become closer to 0).
  • If the inner state of a patch is closer to 0.5, the boundaries at which becomes closer to 0 or 1 are somewhere between MIN-BIRTH and MIN-STAY-ALIVE, and MAX-BIRTH and MAX-STAY-ALIVE.

In order achieve the transition between dead and alive in a continuous fashion, the sigmoid function is used. The sigmoid function is shaped like an "S", where the bottom of the "S" starts at 0 and the top ends at 1. Thus, the sigmoid function is like a step function that jumps from 0 to 1, except that it takes on intermediate values between 0 and 1 near the place where it would otherwise jump. The sigmoid function is also used to transition between the amount that the MIN-BIRTH/MAX-BIRTH and MIN-STAY-ALIVE/MAX-STAY-ALIVE ranges are used. The actual transition function used can be visualized with VISUALIZE-TRANSITION. See HOW TO USE IT for details.

HOW TO USE IT

Press SETUP to initialize the world randomly and GO to run the model.

OUTER-RADIUS controls the radius of each cell's neighborhood and RADIUS-RATIO determines how much that radius the cell itself takes up. Thus, the cells have radius OUTER-RADIUS / RADIUS-RATIO.

The precise meaning of the various parameters is somewhat complicated, but intuitively:

  • MIN-BIRTH and MAX-BIRTH define the range of neighborhood states in which a dead cell (a cell with state less than 0.5) will become alive.
  • MIN-SURVIVE and MAX-SURVIVE define the range of neighborhood states in which a living cell (a cell with state more than 0.5) will remain alive.
  • INNER-STEP-WIDTH controls how "fuzzy" the transition function is with respect to the cell's state. The smaller the INNER-STEP-WIDTH, the closer to 0 or 1 the patches will be.
  • OUTER-STEP-WIDTH controls how "fuzzy" the transition function is with respect to the neighborhood's state. The smaller the OUTER-STEP-WIDTH, the closer to 0 or 1 the patches will be.

VISUALIZE-TRANSITION and the TRANSITION FUNCTION plot show the actual transition function being used. The plot shows which new patch state different combinations of inner and outer states result in. Black corresponds to 0 and white to 1, as in the model's View. The white band in the center shows what will result in the patch getting a state close to 1. Note that because the band stretches from the top of the plot to the bottom, a patch can always become alive depending on the state of its neighborhood. The fat part of the band at the top is the range of values for which the patch will remain close to 1 (i.e. stay alive). The skinnier part of the band at the bottom is the range of values for which the patch will become 1 (i.e. be born). The plot will be updated for the current settings when SETUP is pressed. When VISUALIZE-TRANSITION is running, the plot updates in real-time, allowing you to change the model settings and immediately see how the transition function changes. This is very helpful for understanding the impact each setting has on the transition function.

PAINT allows you to change the state of cells using the mouse. When you press the mouse button while in the view, all patches within PAINT-RADIUS will have their STATEs set to PAINT-VALUE. ERASE-ALL sets all patches to 0 if you want to paint your own state from scratch.

THINGS TO NOTICE

Objects that appear to glide across the screen will quickly appear when starting from an initial random configuration. Much like in the Game of Life, these gliders are in fact continuously recreating themselves at adjacent positions. Can you figure out how they work?

With small fluctuations, a glider object can either split into multiple gliders or die out.

Many of the emergent structures in this model consist of curved, organic-looking membranes of living cells. Why might this be?

When you decrease OUTER-RADIUS, the gliders and other structures become smaller. Why might this be? If you decrease OUTER-RADIUS too much, the structures won't form anymore. Why not?

THINGS TO TRY

Using the paint functionality, can you create a glider? Can you create any other stable structures?

Can you find parameters for the model that produce other types of emergent structures?

EXTENDING THE MODEL

While the TRANSITION FUNCTION plot visualizes the state transitions, it's very small and computationally intensive. Can you figure out another way to visualize the state transitions? Hint: try using patches.

The paper describing the SmoothLife model also includes a way of making the model continuous in time as well as in space and value. See the CREDITS AND REFERENCES section. Can you make this model continuous in time?

NETLOGO FEATURES

This is a computationally intensive model. In order to keep things fast, the model stores the inner and outer neighborhoods of each patch at SETUP. Furthermore, the model only looks at patches with a significantly large STATE when computing the inner and outer neighborhood values. That is, many patches will have STATE close to, but not quite at 0 (less than 0.0001). For performance, we treat those patches as though they have STATE 0.

The plot in this model shows how to visualize a function that takes two inputs and outputs a single number. It does so by plotting a grid of tightly spaced points, where the color of the points corresponds to the output of the function. However, this is a very computationally intensive method and is not recommended for general use.

RELATED MODELS

  • Life

CREDITS AND REFERENCES

Rafler, S. (2011). Generalization of Conway's "Game of Life" to a continuous domain-SmoothLife. arXiv preprint arXiv:1111.1567.

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:

Please cite the NetLogo software as:

COPYRIGHT AND LICENSE

Copyright 2017 Uri Wilensky.

CC BY-NC-SA 3.0

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)