B-Z 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.0pre8 • Viewed 269 times • Downloaded 35 times • Run 1 time
Download the 'B-Z 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.)


VERSION

$Id: B-Z Benchmark.nlogo 37529 2008-01-03 20:38:02Z craig $

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 [state new-state]

to benchmark
  random-seed 5454
  reset-timer
  setup
  repeat 10 [ go ]
  set result timer
end 

to setup
  ca
  ask patches
    [ set state random (n + 1)   ;; pick a state from 0 to n
      set pcolor scale-color red state 0 n ]
end 

to go
  ;; first all the patches compute their new state
  ask patches [ find-new-state ]
  ;; only once all the patches have computed their new state
  ;; do they actually change state
  ask patches
  [ set state new-state
    set pcolor scale-color red state 0 n ]
  tick
end 

to find-new-state  ;; patch procedure
  ifelse state = n  ;; ill?
    [ set new-state 0 ] ;; get well
    [ let a count neighbors with [state > 0 and state < n]  ;; count infected
      let b count neighbors with [state = n] ;; count ill
      ifelse state = 0  ;; healthy?
        [ set new-state int (a / k1) + int (b / k2) ]
        [ let s state + sum [state] of neighbors
          set new-state int (s / (a + b + 1)) + g ]
      if new-state > n   ;; don't exceed the maximum state
        [ set new-state n ] ]
end 

There are 2 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 14 years ago B-Z Benchmark Download this version
Uri Wilensky over 14 years ago B-Z Benchmark Download this version

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.