Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time



A partial JavaScript adaptation of Bob Tinker’s NetLogo model Bureaucrats.v6 exploring Self-Organised Criticality

The mathematics of avalanche size and frequency follows a power law that can be simulated to
a first approximation by any system that exhibits self-organized criticality (SOC). In “How
Nature Works”" Per Bak reports a simplified model of a sandpile that he, Chao Tang, and Curt
Wiesenfeld developed that shows SOC, the so-called BTW model. Bak also mentions that
Grassberger describes a representation of this model that is fanciful but equivalent to the
BTW model. Imagine an N-by-N grid of office desks and a bureaucrat sitting at each. A folder
is randomly assigned to one desk. The bureaucrat does nothing until four or more folders are
on his desk at which time he sends one to each of his four nearest neighbors. Any bureaucrat
sitting at the edge of this array throws a folder out the window if there is no desk to send
it to. Sometimes, adding one folder can cause multiple redistributions of folders as one
bureaucrat’s actions causes neighbors to exceed three folders, which then ripples through
the office. In principle, just adding one new folder might involve redistribution at every
desk, sometimes multiple times.

The screen after approximately 5000 avalanches.

screenshot of avalanche2d-js

I’m working on new ways of being able to create and run models in html5 browser-technologies that we used to build with Java and wanted to see how hard it would be to convert one of Bob’s NetLogo models. The avalanche/bureaucrat model was a good first choice because it only uses the patches feature of NetLogo and not turtles.

While it would take a good deal more work to make a whole authoring environment that would be effective and productive for non-professional programmers I think this is a very successful proof-of-concept. At this point I think it would be relatively easy to convert a model that had turtles also.


Seth Tisue, the lead NetLogo developer contributed both Bureaucrats-fast a simplified re-write of Bureaucrats.v6 that runs about 20 times as fast as the original and a version of the model algorithm written in straight Scala Bureaucrats.scala. The speed of the Scala version should be comparable to the speed of a native Java adaptation.

Testing Oct 28 2011 show this JavaScript adaptation runs the model about the same speed as the native Scala version and about 12 times faster than Bureaucrats-fast" in NetLogo 5.0RC2 and about 18 times faster when also displaying the folder visualization and graph (Chrome 14.0.835.186 on a Mac OS X 10.6.8 system with a 2.66 GHz Intel Core i7).

A Google Spreadsheet is available with more complete Avalanche2D-JS Benchmarks comparing the performance of the model and the model, visualization, and grapher in Scala and NetLogo and on various browsers and operating systems including Android and iOS tablets and smartphone systems.

Self-Organised Criticality References

  1. Review of: How Nature Works: The Science of Self-Organised Criticality, Per Bak, New York, NY: Copernicus Press 1996
  2. Self organized criticality in earth systems By Stefan Hergarten, page 94
  3. On the avalanche size distribution in the BTW model
  4. Wikipedia: Self-Organised Criticality

Programming References

  1. Efficient Script Yielding
  2. setImmediate
  3. W3C: Timing control for script-based animations
  4. W3C: Real-Time Web Communications Working Group
  5. Real-Time Web Communication Use-cases and Requirements
  6. W3C: Audio Working Group"
  7. Beyond HTML5 Audio Capture in Web Browsers
  8. W3C: Web Audio API
  9. Web Audio Examples


A partial JavaScript port of Bob Tinker's NetLogo model Bureaucrats.v6 exploring Self-Organised Criticality



No packages published