An implemention of the model described in the book How nature works; a sandpile model with the property self-organized criticality.
Project page on GitHub
You can download a ready to launch executable or all of the source code from GitHub, here's how you do it.