Life Benchmark

No preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

(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 4.1pre9 • Viewed 117 times • Downloaded 16 times • Run 0 times
Download the 'Life Benchmark' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

globals [result]

patches-own [
  living?         ;; indicates if the cell is living
  live-neighbors  ;; counts how many neighboring cells are alive
]

to benchmark
  random-seed 22
  reset-timer
  setup-random
  repeat 500 [ go ]
  set result timer
end 

to benchmark-__life
  random-seed 22
  reset-timer
  setup-random
  repeat 500 [ __life ]
  set result timer
end 

to setup-random
  clear-all
  ask patches
    [ ifelse random-float 1.0 < initial-density
        [ cell-birth ]
        [ cell-death ] ]
end 

to cell-birth
  set living? true
  set pcolor fgcolor
end 

to cell-death
  set living? false
  set pcolor bgcolor
end 

to go
  if mouse-down?
    [ stop ]  ;; wait for user to stop drawing
  ask patches
    [ set live-neighbors count neighbors with [living?] ]
  ;; Starting a new "ask patches" here ensures that all the patches
  ;; finish executing the first ask before any of them start executing
  ;; the second ask.  This keeps all the patches in sync with each other,
;; so the births and deaths at each generation all happen in lockstep.
  ask patches
  [ ifelse live-neighbors = 3
      [ cell-birth ]
      [ if live-neighbors != 2
      [ cell-death ] ] ]
  tick
end 

There are 3 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Life Benchmark Download this version
Uri Wilensky over 12 years ago Life Benchmark Download this version

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.