Random Cellular Automata

Random Cellular Automata preview image

1 collaborator

Moi Yassine Chaouche (Author)

Tags

cellular automata 

Tagged by Yassine Chaouche almost 12 years ago

patch 

Tagged by Yassine Chaouche almost 12 years ago

random 

Tagged by Yassine Chaouche almost 12 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.1 • Viewed 873 times • Downloaded 57 times • Run 0 times
Download the 'Random Cellular Automata' 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?

An experiment on very random cellular automata

HOW IT WORKS

Each patch changes its color depending on the color of its neighbors

HOW TO USE IT

Click add a cell then click on the grid to create some new white cells. Choose of the functions in the functions selector, then click go forever to see the animation that each function produces on your initial state (the position of initial white cells). You may want to click on step to follow a step by step execution of the algorithme.

THINGS TO NOTICE

Function 1 : form a round shape of white cells and start the simulation. If the cells don't spread, stop the simulation and try again by adding more white cells, always in a rounded shape. A few cells (20 to 30 cells) should be enough. The cells spread all around.

Function 2 : don't turn any cell on, start right off with a black grid and click go forever. The screen will look like a circuit board, except it is red. After less than 500 ticks you should see a white cells explosion coming from a random place that invades all the screen in 10 ticks or so. This doesn't always happen. If it's the case, keep the go forever button toggled and click the clear button. This will reset the screen and keep the simulation going. If nothing happens in less than 500 ticks you may try again until you see that white cell explosion.

Function 3 : Keep the simulation button toggeld and add cells on the go. They will move like an animated worms and then die in a matter of some ticks. The celles look like a living organisme. I didn't manage to get them fill the screen.

Funciton 4: Don't add any cell, just start the simulation on a blank screen. You should see a red screen after 2 or 3 ticks only, with white cells and a few green cells. The green cells are like microbes that white cells, like antibody, try to kill. After a few ticks all the green cells are killed by the white ones. But sometimes green cells win :)

Function 5 : Clear the field, draw a few cells, and clck on the step button this time. You will see that this kind of cells advance in one specific direction, not randomly in all directions. They go one direction for a certain amount of steps, and then they sort of "split", changing direction orthogonically and so on.

Function 6 : turn on some cells (5 to 10), then click go forever. After coloring all the grid, there are a couple of long animated curved lines of patches. The grid looks like a geographical map.

Function 7 : draw some shapes at different locations then click go forever and watch them burn.

Function 8 : Fill up the screen with another fuction (example function 2), then click the go forever button, wait for around 200 ticks then "let it snow, let it snow, let it snoooooow !"

Function 9 : Click on the go forever button and draw anything on the grid, a 3D effect should be appllied.

Function 10 : [...] applies a green contour to your drawings, giving it a funky neon style.

Function 11 : blinky blinky :) (one random patch at a time)

Function 12 : Draw something that looks like a vertical line, it's ok to doodle around a bit, then click go forever. Adjust the simulation speed and look at the moving objects. After a few seconds of observation and a little bit of imagination, you should be seeing a cylindric object, rolling from left to right around itself. If you'r lucky enough you may see a ballet dancer :)

Function 13 : Create some white cells and watch the curious living creature that results from it. The organisme seem to only develop from certain extremities it chooses randomly and grows very slowly, extending its 'arms' a little by little at each tick.

Function 14 : Create some white cells then click on the go forever button, a white marble square will appear with angular lines (black "nerves")

THINGS TO TRY

(suggested things for the user to try to do (move sliders, switches, etc.) with the model)

EXTENDING THE MODEL

NETLOGO FEATURES

RELATED MODELS

CREDITS AND REFERENCES

Yacine Chaouche yacinechaouche@yahoo.com http://ychaouche.wikispot.org

Comments and Questions

Some random cellular automata fun

Check the info section. There are 6 functions that demonstrate various rather randomly coded rules for patches. They change color based on the color of their neighbours. The results are quite different. Read the info section then choose one of the functions and follow the instructions given in the info section for that function.

Posted almost 12 years ago

Interesting, cool, fun!

This is cool, thanks for contributing it. Amazing how many new and different things can be done with CA. -Jim

Posted almost 12 years ago

Netlogo makes it easier

This is my first step in the world of cellular automata.It was funny :)

Posted almost 12 years ago

Now 14 functions

Code updated to add new CA fun.

Posted over 8 years ago

Click to Run Model

globals [last-patch]

to setup
  clear-all
  reset-ticks
end 

to step
  ask patches [change-color]
  tick
end 

to change-color
  run word "run_" function-name
end 

to add-cell
  if mouse-down?
  [
    set last-patch patch mouse-xcor mouse-ycor
    ask last-patch [set pcolor white]

  ]
end 

to clear-cell
  if mouse-down?
  [ask patch mouse-xcor mouse-ycor [set pcolor black]]
end 

to run_function1
  ifelse pcolor = black
  [ if count neighbors4 with [pcolor != black] = 2
    [
      set pcolor white
      ask neighbors4 with [pcolor != black] [set pcolor black]
    ]
    if count neighbors4 with [pcolor != black] = 3
    [
      set pcolor white
      ask neighbors4 with [pcolor = black] [set pcolor white]
    ]
  ]
  [
    if count neighbors4 with [pcolor = white] = 2
    [set pcolor (pcolor + 1)
    ]
  ]
end 

to run_function2
  ifelse pcolor != white
  [ if count neighbors with [pcolor = black] < 2
    [
      set pcolor white
      ask neighbors with [pcolor = black] [set pcolor red]
    ]
    if count neighbors with [pcolor != black] < 3
    [
      set pcolor (pcolor + 1)
      ask neighbors4 with [pcolor != black] [
        set pcolor red
      ]
    ]
  ]
  [
    if count neighbors4 with [pcolor = white] < 2
    [set pcolor (black)
    ]
  ]
end 

to run_function3
  ifelse pcolor = white
  [ if count neighbors4 with [pcolor = white] = 2
    [
      set pcolor black
      ask neighbors4 with [pcolor = white] [set pcolor black]
    ]
    if [pcolor] of one-of neighbors = white
    [
      set pcolor (pcolor + 0.1 )
      ask neighbors4 with [pcolor = black] [set pcolor white]
    ]
  ]
  [
    if count neighbors4 with [pcolor = white] > 2
    [set pcolor (pcolor - 0.1)
    ]
  ]
end 

to run_function4
  if pcolor = black
  [ if count neighbors with [pcolor = green] = 2
    [
      set pcolor green
      ask neighbors with [pcolor = red] [set pcolor green]
    ]
    if count neighbors4 with [pcolor = white] = 2
    [
      set pcolor green
      ask neighbors4 with [pcolor = black] [set pcolor white]
    ]
  ]
  
  if pcolor = black
    [
      set pcolor (red)
      ask neighbors4 with [pcolor != white] [set pcolor white]
      
    ]
  
  if pcolor = red
      [ask neighbors [set pcolor [pcolor] of one-of neighbors]]
end 

to run_function5
  if pcolor = white
  [ 
    if count neighbors4 with [pcolor = red] = 1
    [
      set pcolor red
      ask neighbors4 with [pcolor = white] [set pcolor red]
    ]
    
    if count neighbors4 with [pcolor = green] = 1
    
    [
      set pcolor green
      ask neighbors4 with [pcolor = black] [set pcolor red]
    ]
    
    if count neighbors4 with [pcolor = black] = 4
      [
        set pcolor red
        ask neighbors4 with [pcolor = black] [set pcolor green]
      ]
    
    
  ]
  if pcolor = green
  [
    if count neighbors4 with [pcolor = red] = 4
    [
      set pcolor (white)
      ask neighbors4 with [pcolor = red] [set pcolor green]
    ]
  ]

  if pcolor = red
  [  
    set pcolor (white)
    ask neighbors4 with [pcolor = red] [set pcolor green] 
  ]
end 

to run_function6
  if count neighbors4 with [pcolor = white] = 2
  [
    ifelse pcolor = white
    [
      set pcolor orange
    ]
    [set pcolor white]
  ]
  if count neighbors4 with [pcolor = white] = 1
  [
    ifelse pcolor < red + 5 and pcolor > red - 5
    [
      set pcolor (pcolor + 1)
      if pcolor > red + 5
      [set pcolor (red - 5)]
    ]
    [set pcolor white]
  ]
   if count neighbors4 with [pcolor = black] = 2
   [
     set pcolor [pcolor] of one-of neighbors4
     ask one-of neighbors4 [set pcolor red]
     ]
end 

to run_function7

  if [pcolor] of patch-at 0 1 = black and not ([pcolor] of patch-at 1 0 = white)
  [
    set pcolor black
    ;ask patch-at 0 -1 [set pcolor white]
  ] 
  
  if [pcolor] of patch-at -1 0 = white and not ([pcolor] of patch-at 0 -1  = black)
  [
    set pcolor white
  ]
    
    
  if [pcolor] of patch-at -1 0 = black and not ([pcolor] of patch-at 0 -1  = black)
  
  [
    ask one-of neighbors4 [set pcolor red]
  ]
end 

to run_function8

  if count neighbors4 with [pcolor = black] = 2
  [
    ask patch-at  0  1 [set pcolor white]
    ask patch-at  0 -1 [set pcolor black]
  ]

  if count neighbors4 with [pcolor = white] = 4
  [
    ask patch-at  0  1 [set pcolor white]
    ask patch-at -1  0 [set pcolor green]
  ]
  
  if count neighbors4 with [pcolor = green] = 2
  [
    ask patch-at  0  1 [set pcolor green]
    ask patch-at  0 -1 [set pcolor white]

  ]

  if count neighbors4 with [pcolor = red] >= 2
  [
    ask patch-at  1  0 [set pcolor white]
    ask patch-at -1  0 [set pcolor white]
  ]
end 

to run_function9
  if [pcolor] of one-of neighbors4 = white
  [
    ask one-of neighbors [set pcolor black]
    ask patch-at 1 1 [set pcolor blue + 13]
  ]
  
  if [pcolor] of one-of neighbors4 = blue + 13
  [
    ask one-of neighbors [set pcolor blue ]
    ask patch-at 1 1 [set pcolor yellow]
  ]
end 

to run_function10
  
  if [pcolor] of one-of neighbors = black
  [ 
    ask neighbors with [pcolor = green] [set pcolor pcolor + 1]
  ]
  if pcolor = white
  [
    ask neighbors4 with [pcolor = black] [set pcolor green]
  ]
end 

to run_function11
  
  if [pcolor] of one-of neighbors4 = white
  [ 
    ask neighbors with [pcolor = black] [set pcolor green]
  ]
  if pcolor = white
  [
    ask patch-at 0 1 [set pcolor white]
    ask neighbors in-radius 5 [set pcolor green]
  ]
end 

to run_function12
  if pcolor = white
    [      
      if any? other patches in-radius 5 with [pcolor = white]
      [
        set pcolor black
        ask patch-at 1 0 [set pcolor white]
      ] 
    ]
end 

to run_function13
  if count neighbors with [pcolor = black] = 3
    [set pcolor white]
  if count neighbors with [pcolor = black] = 6
    [set pcolor [pcolor] of one-of neighbors]
  if count neighbors with [pcolor = black] = 0
    [set pcolor white]
  if count neighbors with [pcolor = white] = 5
    [set pcolor white]
end 

to run_function14
  if pcolor = black
  [
    if [pcolor] of patch-at 0 1 = white
    [
      set pcolor orange
      ask neighbors4 [set pcolor white]
    ]
  ]
  
  if [pcolor] of patch-at 1 0 = white
  [ 
    set pcolor orange
  ]
  
  if pcolor = orange
  [
      set pcolor mean [pcolor] of neighbors
  ]
end 

to debug
  ask patches [debug-patch]
end 

to debug-patch
  if pcolor = white
  [
    ask other patches in-radius 4 with [pcolor = white and (distance myself) > 2] [set pcolor red]
  ]
end 

There are 4 versions of this model.

Uploaded by When Description Download
Yassine Chaouche over 10 years ago Added 8 new functions Download this version
Yassine Chaouche almost 12 years ago Forgot to save :) Download this version
Yassine Chaouche almost 12 years ago 6 new functions Download this version
Yassine Chaouche almost 12 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Random Cellular Automata.png preview preview over 9 years ago, by Yassine Chaouche Download

This model does not have any ancestors.

This model does not have any descendants.