Conway’s Game of Life

Conway’s Game of Life preview image

1 collaborator

Tags

cellular automaton 

Tagged by Jaroslaw Miszczak over 3 years ago

game of life 

Tagged by Jaroslaw Miszczak over 3 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.2.1 • Viewed 479 times • Downloaded 37 times • Run 0 times
Download the 'Conway’s Game of Life' 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?

Conway's Game of Life: https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

Both synchronous and asynchronous updating policies are implemented.

HOW IT WORKS

Red cells are alive, white cells are dead.

HOW TO USE IT

Set the initial conditions and observer the evolution.

THINGS TO NOTICE

Some popular formation could occur in the case of synchronous updating. It is possible to switch between synchronous and asynchronous updating durinig the game.

THINGS TO TRY

One intersting modificaiton is the percentage of living celles at the begining of the game.

Another thing to try is to chenage the treshold for dying of the cell.

EXTENDING THE MODEL

At the moment all patches are updated during each step.

RELATED MODELS

Many models in the NetLogo Models Library already implement this game.

CREDITS AND REFERENCES

Asynchronous cellular automaton, https://en.wikipedia.org/wiki/Asynchronous_cellular_automaton

H.J. Blok, B. Bergersen, "Synchronous versus asynchronous updating in the “game of Life”", Phys. Rev. E 59, 3876 (1999), https://doi.org/10.1103/PhysRevE.59.3876

Comments and Questions

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

Click to Run Model

patches-own [
  next-pcolor ;; the next state is calculated using current pcolor
]

;; clear the board and create some life

to setup
  clear-all
  reset-ticks

  ;; make the world with custom size
  resize-world 0 (world-size - 1) 0 (world-size - 1)
  set-patch-size floor ( 50 / (sqrt world-size) )

  ;; use next-pcolor to initialize pcolor
  ask patches [
    ifelse random 100 < init-life [
      set next-pcolor green
    ][
      set next-pcolor white
    ]
    set pcolor next-pcolor
  ]
end 

;;
;; main function
;;

to go
  ifelse synchronous [
    ask patches [
      simulate-life
    ]
    ask patches [
      update-color
    ]
  ][
    ask patches [
      simulate-life
      update-color
    ]
  ]

  tick
end 

;;
;; calculate the updating rule
;; and save it the next state
;;

to  simulate-life
  let x (count neighbors with [ pcolor = green] )

  ;; set plabel x ;; [debug]

  ifelse pcolor = green [
    ifelse x < 2 or x >= 4 [ ;; x>=4 (weak inequality) - standard rule
      set next-pcolor white ;; ie. die
    ][
      set next-pcolor green ;; ie. stay alive
    ]
  ][ ;; pcolor = white
    if x = 3 [
      set next-pcolor green ;; ie. live
    ]
  ]
end 

;;
;; update the state
;;

to update-color
  set pcolor next-pcolor
end 

There are 2 versions of this model.

Uploaded by When Description Download
Jaroslaw Miszczak over 3 years ago Simplified update Download this version
Jaroslaw Miszczak over 3 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Conway’s Game of Life.png preview Preview for 'Conway’s Game of Life' over 3 years ago, by Jaroslaw Miszczak Download

This model does not have any ancestors.

This model does not have any descendants.