Urban Suite - Cells

Urban Suite - Cells preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)


(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 252 times • Downloaded 19 times • Run 0 times
Download the 'Urban Suite - Cells' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


This is a model of 2d cellular automata. It uses very simple rules to grow a form. These forms may be very complex, or highly regular.


At each step, each patch looks to see if it satisfies the rules defined for being turned on. The rule is defined by the NEIGHBORHOOD chooser and the N-COUNT chooser. If the number of currently turned on patches in the NEIGHBORHOOD around the patch is non-zero and also satisfies N-COUNT, then that patch has a chance to turn. The change to turn on is defined by the PROBABILITY slider. If AGE-LIMIT is non-zero, then any patches that have been turned on for more ticks than AGE-LIMIT will be turned off.

The patches color shows their age, with darker patches being older than lighter patches.


Press SETUP to clear the board and create the initial seed patch. Optionally, you may also press the RANDOM SEED button to create another seed in a random location.

Press the GO * 80 button and the model will run thru 80 ticks. You may also press the STEP button to advance the model a single tick. Lastly, the GO button will run the model an unlimited number of ticks, until it is pressed again.

The NEIGHBORS and N-COUNT choosers define the rule used to determine if a patch turns on or not, see the HOW IT WORKS section for details.

PROBABILITY is the chance a patch has of turning on if it satisfies the current rule.

AGE-LIMIT is the number of ticks a patch will stay turned on. If AGE-LIMIT is 0, then there is no AGE-LIMIT defined and turned on patches stay that way forever.

The CYCLE COLORS button will make all turned on patches to cycle their colors.

The LIVE CELLS plot is a plot of the patches that are turned on at each tick.


Which rules produce the most complex shape?

How many ticks does it take for the rules to fill up the world?


Some rules will result in a form that grows and fills the whole space, while others will have empty spots in them.

If you play with the PROBABILITY slider you can get asymmetrical forms, and also cause "mutations" in the growth of a form that would otherwise stop growing after a set number of ticks. Such mutations can grow to fill in more patches because of the irregularity.


Add new neighborhoods to the NEIGHBORHOODS chooser. You can do this by writing a reporter with the same name as your new neighborhood and adding the name to the chooser.


The scale-color primitive is used to set the color of patches according to their age.


This model is related to all of the other models in the "Urban Suite".

This model is also similar to the models in the Computer Science/Cellular Automata section of the NetLogo models library.


This model is based from the models described in chapter 2 of the book "Cities and Complexity" by Michael Batty.

Thanks to Craig Brozefsky for his work on this model.

The Urban Suite models were developed as part of the Procedural Modeling of Cities project, under the sponsorship of NSF ITR award 0326542, Electronic Arts & Maxis.

Please see the project web site ( http://ccl.northwestern.edu/cities/ ) for more information.


If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:


Copyright 2007 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://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.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

patches-own [ on? on-time seedp ]

globals [ starting-color on-cells ]

;; Setup Procedures

to setup
  set starting-color blue + 4
  ask patches [ set on? false set seedp false ]
  ask patch 0 0 [ turn-on set seedp true set pcolor white ]
  set on-cells patches with [ on? ]

to create-random-seed
  ask patch random-pxcor random-pycor [ turn-on set seedp true set pcolor white ]
  set on-cells patches with [ on? ]

;; Runtime Procedures

to go
  let min-on-time ticks - age-limit
  ask patches with [ ( on? = false ) and turn-on? ]
    [ turn-on ]
  if ( age-limit > 0 ) [ ask patches with [ on-time < min-on-time ] [ turn-off ] ]
  set on-cells patches with [ on? ]
  plot count on-cells

to turn-on
  set on? true
  set on-time ticks

to turn-off
  set on? false
  set on-time 0
  set pcolor black

to-report turn-on? ;; patch procedure
  let cells runresult (word "count " neighborhood " with [ on? ] ")
  ifelse ( cells > 0 and runresult (word cells " " n-count) )
     [ report random 100 < probability ]
     [ report false ]

to-report age ;; patch procedure
  report ticks - on-time

to color-cells
  if ( any? on-cells ) [
    let latest min [ on-time ] of on-cells
    let earliest max [ on-time ] of on-cells
    ask on-cells
      [ if ( not seedp )
         [ set pcolor ( scale-color starting-color on-time latest ( earliest + 5 ) ) ] ]

;; Neighborhood Reporters

to-report von-neumann ;; patch procedure
  report neighbors4

to-report moore ;; patch procedure
  report neighbors

to-report displaced-von-n ;; patch procedure
  let vn neighbors4
  report neighbors with [ not member? self vn ]

to-report h ;; patch procedure
  let pa patch-at 0 1
  let pb patch-at 0 -1
  report neighbors with [  self != pa and self != pb ]

to-report moore-von-n ;; patch procedure
  let m neighbors
  report patches in-radius 2 with
    [ member? self m
      or ( pxcor = [ pxcor ] of myself )
      or ( pycor = [ pycor ] of myself ) ]

; Copyright 2007 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky about 10 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky over 10 years ago Updated version tag Download this version
Uri Wilensky over 10 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky over 11 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky almost 13 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 13 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 13 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 13 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 13 years ago Model from NetLogo distribution Download this version
Uri Wilensky almost 13 years ago Urban Suite - Cells Download this version

Attached files

File Type Description Last updated
Urban Suite - Cells.png preview Preview for 'Urban Suite - Cells' about 10 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.