cellular_automata 0.8.0

  • README.md
  • Installing
  • Versions
  • 49

Cellular Automata

A cellular automata library / playground written in Dart. Happily accepting pull requests! ^_^


  • Simple system for writing optimised rules
  • MCell rules compatible, current systems supported:
    • MCell Generations
  • Generators to seed the simulation
  • Map states to colours/characters for rendering
  • Controls: pause, resume, stepBack, stepForward
  • Stale simulation detection (repeating generations or patterns in activity)
  • Utilises the package:logging for debug & info (view on pub)
  • Decoupled renderers:
    • Canvas: (Web), fullscreen support
    • StageXL: (Web), WebGL, fullscreen support, (performance issues with big scenes)

Implemented rules/simulations

  • Conway's Game of Life (source)
  • Conway's Game of Life Simple (binary states) (source)
  • Brian's Brain (source)
  • Majority Vote (source)
  • MCell Generations rule parser. See the demos including:
    • Star Wars
    • Rake
    • Star Wars
    • Sedi Mental
    • Frozen Sprials


See the demos/ folder for demos. You can try the hosted demos here.


Dartium performance is significantly faster than compiled performance at the moment. Also there are some generator defects that are yet to be resolved. To try and increase use the trust-type-annotations flag in your pubspec:

- $dart2js:
    checked: false
    minify: true
    commandLineOptions: ['--trust-type-annotations', '--trust-primitives']


  • Add more MCell rule parsers
  • Add MCell rule database
  • Add multiple states to 'Majority Vote'
  • Add visual feedback to show processing of simulations - useful whilst building and debugging
  • Support for entities to exist which would allow for simulations such as Langton's Ant
  • Add a multiple states generator
  • Add more tests
  • Transitions for switching between two simulations
  • Multiple simulations/rule-sets running in a single scene
  • Generated color palettes
  • Interactive mode (edit mode)
  • Analysis tools (histograms for state counts)
  • Add an LED Matrix renderer for raspberry pi using GPIO pins
  • Flutter renderer
  • CLI renderer
  • Hexagonal grids
  • Infinite world size support


Please see the credits file for a list of the authors that discovered the rules that have been implemented in this project.


Please see the cellular_automata license.



  • MCellGenerations rule parser added. This can parse all MCell Generations configs.
  • Credits
  • onStable renamed onComplete, now passes SimulatorCompleteReason enum value. Current states are: duration and stable
  • Demos updated to include MCell
  • Credits file created to credit those that wrote/discovered the rules
  • Decent Refactor, reorganised stuff!
    • Simulator renamed Player
    • Array2D replaced with CellGrid which combines Array2D with CA specific functionality which simplifies CellWorld.
    • CARules interface updated
    • CellWorld renamed Simulator


  • Optimised MajorityVote Rules, utilises edge detection to determine activity
  • Added paintFullSize option to CanvasRenderer: This allows the scene to be painted at actual size rather than small and then resized via CSS.
  • Added maxAge as a Simulator constructor parameter, if this is set then onStable is called when the generation count surpasses maxAge
  • Added package:logging so debug information can be enabled / disabled
  • Updated demos


  • Stable simulation detection. This broadcast to the onStable stream after detecting repeating identical generations or repeating generation activeCellCount patterns spanning up to 8 generations.
  • Demos updated to auto reset on stable scene (excluding rendering examples)


  • Added new default renderer for web: CanvasRenderer. This is a simple native Canvas renderer. This has been added as StageXLRenderer has performance issues with large scenes.
  • Added demos for both StageXLRenderer and CanvasRenderer
  • Demos moved over to use CanvasRenderer


  • Added MajorityVote Rules
  • Optimised BriansBrain processing
  • Updated demos


  • Added GameOfLifeSimple Rules. This simulation is a simpler version of GameOfLife, it only has binary states and implemented with minimal code
  • Added BriansBrain Rules
  • Updated demos


  • Optimised cell processing, now only processes cells that neighbor active states
  • Added tests (more to add)
  • Improved StageXL bitmap colours crispness by adding frame margin


  • Refactored so Rule's cell-states are now passed as generic types in to the Cell World for better analyzer & tooling support
  • Added a CAGenerators for generating/seeding worlds
  • Renderers are now further decoupled from the Simulation. They now just require an CellGrid containing states expressed in a palette.
  • Added a very simple demo (simple_example.dart) to show minimum setup code
  • CellWorld now stores full cell-states and Rules also deal with full cell-states which makes code more readable
  • Fixed mathematical generators


  • Initial version, includes basic implementation of GameOfLife with StageXLRenderer
  • Hosted demos

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  cellular_automata: "^0.8.0"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:cellular_automata/cellular_automata.dart';
Version Uploaded Documentation Archive
0.8.0 Jul 9, 2017 Go to the documentation of cellular_automata 0.8.0 Download cellular_automata 0.8.0 archive
0.7.0 Jul 7, 2017 Go to the documentation of cellular_automata 0.7.0 Download cellular_automata 0.7.0 archive
0.6.0 Jul 5, 2017 Go to the documentation of cellular_automata 0.6.0 Download cellular_automata 0.6.0 archive
0.5.0 Jul 4, 2017 Go to the documentation of cellular_automata 0.5.0 Download cellular_automata 0.5.0 archive
0.4.0 Jul 4, 2017 Go to the documentation of cellular_automata 0.4.0 Download cellular_automata 0.4.0 archive
0.3.0 Jul 3, 2017 Go to the documentation of cellular_automata 0.3.0 Download cellular_automata 0.3.0 archive
0.2.0 Jul 2, 2017 Go to the documentation of cellular_automata 0.2.0 Download cellular_automata 0.2.0 archive


We analyzed this package on Jun 19, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
98 / 100
Reflects how tidy and up-to-date the package is. [more]
99 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:cellular_automata/cellular_automata.dart.


  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 error 4 hints.

    Strong-mode analysis of lib/src/rules/majority_vote.dart failed with the following error:

    line: 36 col: 17
    The argument type '(int) → Null' can't be assigned to the parameter type '(dynamic) → void'.

    Strong-mode analysis of lib/cellular_automata.dart gave the following hint:

    line: 4 col: 8
    Unused import: 'package:logging/logging.dart'.

    Similar analysis of the following files failed:

    • lib/src/cell_grid.dart (hint)
    • lib/src/renderers/canvas.dart (hint)
  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use cellular_automata.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0
collection ^1.14.1 1.14.10
logging ^0.11.3+1 0.11.3+1
stagexl ^1.2.0+3 1.3.1+4
Transitive dependencies
matcher 0.12.3
path 1.6.1
petitparser 1.7.6
stack_trace 1.9.2
xml 3.0.0
Dev dependencies
browser ^0.10.0
bwu_grinder_tasks ^0.1.1-dev
color ^2.0.2
dart_to_js_script_rewriter ^1.0.1
params ^0.0.4
test ^0.12.23+1