CA 1D Totalistic

CA 1D Totalistic preview image

2 collaborators

Uri_dolphin3 Uri Wilensky (Author)
Eytan Bakshy (Author)

Tags

cellular automata 

Tagged by Reuven M. Lerner over 5 years ago

computer science 

Tagged by Reuven M. Lerner over 5 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 241 times • Downloaded 17 times • Run 0 times
Download the 'CA 1D Totalistic' modelDownload this modelEmbed this model

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


WHAT IS IT?

This program is a one-dimensional three-color totalistic cellular automata. In a totalistic CA, the value of the next cell state is determined by the sum of the current cell and its neighbors, not by the values of each individual neighbor. The model allows you to explore all 2,187 3-color totalistic configurations.

This model is intended for the more sophisticated users who are already familiar with basic 1D CA's. If you are exploring CA for the first time, we suggest you first look at one of the simpler CA models such as CA 1D Rule 30.

HOW IT WORKS

Each cell may have one of three colors with the value 0, 1, or 2. The next state of a cell is determined by taking the sum value of the center, right, and left cell, yielding seven possible sums, 0-6, represented as the state-transition sliders sum-0 through sum-6. Each of these seven possible states maps on to one of the 3 colors which can be set using the state-transition sliders.

HOW TO USE IT

SETUP SINGLE: Sets up a single color-two cell centered in the top row SETUP RANDOM: Sets up cells of random colors across the top row based on the following settings:

  • one-two-proportion: the proportion between color-one and color-two
  • density: what percentage of the top row should be filled randomly with color-one and color-two AUTO-CONTINUE?: Automatically continue the CA from the top once it reaches the bottom row GO: Run the CA. If GO is clicked again after a run, the run continues from the top CODE: Decimal representation of the seven base three configurations of the totalistic CA SWITCHES: The rules for the CA. Examples:
  • sum-0: all color-zero
  • sum-1: two color-zero and one color-one
  • sum-2: two color-one and one color-zero, OR two color-zero and one color-two
  • sum-6: all color-two COLORS: Set the three colors used in the CA

THINGS TO NOTICE

How does the complexity of the three-color totalistic CA differ from the two-color CA? (see the CA 1D Elementary model)

Do most configurations lead to constantly repeating patterns, nesting, or randomness? What does this tell you about the nature of complexity?

THINGS TO TRY

CAs often have a great deal of symmetry. Can you find any rules that don't exhibit such qualities? Why do you think that may be?

Try starting different configurations under a set of initial random conditions. How does this effect the behavior of the CA?

How does the density of the initial random condition relate to the behavior of the CA?

Does the proportion between the first and second color make a difference when starting from a random condition?

EXTENDING THE MODEL

Try having the CA use more than three colors.

What if the CA didn't just look at its immediate neighbors, but also its second neighbors?

Try making a two-dimensional cellular automaton. The neighborhood could be the eight cells around it, or just the cardinal cells (the cells to the right, left, above, and below).

RELATED MODELS

Life - an example of a two-dimensional cellular automaton CA 1D Rule 30 - the basic rule 30 model CA 1D Rule 30 Turtle - the basic rule 30 model implemented using turtles CA 1D Rule 90 - the basic rule 90 model CA 1D Rule 250 - the basic rule 250 model CA 1D Elementary - a simple one-dimensional 2-state cellular automata model CA Continuous - a totalistic continuous-valued cellular automata with thousands of states

CREDITS AND REFERENCES

Thanks to Eytan Bakshy for his help with this model.

The first cellular automaton was conceived by John Von Neumann in the late 1940's for his analysis of machine reproduction under the suggestion of Stanislaw M. Ulam. It was later completed and documented by Arthur W. Burks in the 1960's. Other two-dimensional cellular automata, and particularly the game of "Life," were explored by John Conway in the 1970's. Many others have since researched CA's. In the late 1970's and 1980's Chris Langton, Tom Toffoli and Stephen Wolfram did some notable research. Wolfram classified all 256 one-dimensional two-state single-neighbor cellular automata. In his recent book, "A New Kind of Science," Wolfram presents many examples of cellular automata and argues for their fundamental importance in doing science.

See also:

Von Neumann, J. and Burks, A. W., Eds, 1966. Theory of Self-Reproducing Automata. University of Illinois Press, Champaign, IL.

Toffoli, T. 1977. Computation and construction universality of reversible cellular automata. J. Comput. Syst. Sci. 15, 213-231.

Langton, C. 1984. Self-reproduction in cellular automata. Physica D 10, 134-144

Wolfram, S. 1986. Theory and Applications of Cellular Automata: Including Selected Papers 1983-1986. World Scientific Publishing Co., Inc., River Edge, NJ.

Bar-Yam, Y. 1997. Dynamics of Complex Systems. Perseus Press. Reading, Ma.

Wolfram, S. 2002. A New Kind of Science. Wolfram Media Inc. Champaign, IL.

HOW TO CITE

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

  • Wilensky, U. (2002). NetLogo CA 1D Totalistic model. http://ccl.northwestern.edu/netlogo/models/CA1DTotalistic. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

COPYRIGHT AND LICENSE

Copyright 2002 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 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.

This model was created as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227.

Comments and Questions

Click to Run Model

globals [
  current-row
  last-code    ;; used to track whether the rule switches should be updated
               ;; to match the slider, or vice versa
  gone?
]

patches-own [value]

to startup
  set gone? false
end 

;; setup single cell of color-one in the top center row

to setup-single
  setup
  ask patches with [pycor = current-row] [ set pcolor color-zero set value 0 ]
  ask patch 0 current-row
  [
    set pcolor color-one
    set value 1
  ]
end 

;; setup cells of random distribution across the top row

to setup-random
  setup
  ask patches with [pycor = current-row]
  [
    ifelse random-float 100.0 < density
    [
      ifelse random-float 100.0 > one-two-proportion  ;; proportion between color-one and color-two
        [ set pcolor color-one set value 1 ]
        [ set pcolor color-two set value 2 ]
    ]
        [ set pcolor color-zero set value 0 ]
  ]
end 

to setup
  ifelse code = last-code  ;; determine whether to update the switches or the code slider
    [ switch-to-code ]
    [ code-to-switch ]
  set last-code code
  cp ct
  reset-ticks
  set current-row max-pycor  ;; set current row to top position
  set gone? false
end 

to setup-continue
  if not gone? [stop]

  let value-list []
  set value-list map [[value] of ?] sort patches with [pycor = current-row]  ;; copy cell states from the current row to a list
  cp ct
  set current-row max-pycor  ;; reset current row to top
  ask patches with [ pycor = current-row ]
  [
    set value item (pxcor + max-pxcor) value-list  ;; copy states from list to top row
    set pcolor value-to-color value
  ]
  set gone? false
end 

to go
  if current-row = min-pycor  ;; if we hit the bottom row
  [
    ifelse auto-continue?  ;; continue
    [
      set gone? true
      display    ;; ensure full view gets drawn before we clear it
      setup-continue
    ]
    [
      ifelse gone?
        [ setup-continue ]       ;; a run has already been completed, so continue with another
        [ set gone? true stop ]  ;; otherwise stop
    ]
  ]
  ask patches with [pycor = current-row]
    [ do-rule ]
  set current-row (current-row - 1)
  tick
end 

to do-rule  ;; patch procedure
  ask patch-at 0 -1
  [
    ;; set the next state of the cell based on the left, center, and right
    set value get-next-value ([value] of patch-at -1 1 +
                              [value] of myself +
                              [value] of patch-at 1 1)
    ;; paint the next cell based on the new value
    set pcolor value-to-color value
  ]
end 

to-report value-to-color [v]  ;; convert cell value to color
  ifelse v = 0
  [ report color-zero ]
  [ ifelse v = 1
      [ report color-one ]
      [ report color-two ]
  ]
end 

to-report get-next-value [sum-value]  ;; determines the next state of the CA cell
  if sum-value = 0 [ report sum-0 ]
  if sum-value = 1 [ report sum-1 ]
  if sum-value = 2 [ report sum-2 ]
  if sum-value = 3 [ report sum-3 ]
  if sum-value = 4 [ report sum-4 ]
  if sum-value = 5 [ report sum-5 ]
  if sum-value = 6 [ report sum-6 ]
end 

;; switch / code utility interface procedures

to switch-to-code  ;; changes code based on the positions of the switches
  set code sum-0
  set code (code + sum-1 * 3)
  set code (code + sum-2 * 9)
  set code (code + sum-3 * 27)
  set code (code + sum-4 * 81)
  set code (code + sum-5 * 243)
  set code (code + sum-6 * 729)
end 

to code-to-switch  ;; changes switches based on the code slider
  let next (trinary-div code) ;; perform long division (base 3)
  set sum-0 (first next)    set next (trinary-div (last next))
  set sum-1 (first next)    set next (trinary-div (last next))
  set sum-2 (first next)    set next (trinary-div (last next))
  set sum-3 (first next)    set next (trinary-div (last next))
  set sum-4 (first next)    set next (trinary-div (last next))
  set sum-5 (first next)    set next (trinary-div (last next))
  set sum-6 (first next)
end 

to-report trinary-div [number]  ;; helper function for long division in base 3
  let tri number mod 3
  report (list tri ((number - tri) / 3))
end 


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

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky almost 6 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky over 6 years ago Updated version tag Download this version
Uri Wilensky over 6 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky about 7 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 8 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 8 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 8 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 8 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 9 years ago Model from NetLogo distribution Download this version
Uri Wilensky almost 9 years ago CA 1D Totalistic Download this version

Attached files

File Type Description Last updated
CA 1D Totalistic.png preview Preview for 'CA 1D Totalistic' almost 6 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.