grid_world 0.1.10 copy "grid_world: ^0.1.10" to clipboard
grid_world: ^0.1.10 copied to clipboard

outdated

A cellular automaton library associated with a square grid. Includes Conway's Game of Life.

GridWorld #

A cellular automaton library associated with a square grid. Includes Conway's Game of Life.

Demo

git clone git@github.com:monopole/grid_world.git
dart grid_world/example/main.dart

The primary interfaces are as follows:

GridWorld #

A GridWorld is a grid of cells that can be dead or alive.

A GridWorld can be constructed from

  • a multi-line string, e.g.

    blinker = GridWorld.fromString('''
    .....
    ..#..
    ..#..
    ..#..
    .....
    ''');
    

    where . means dead, and anything else means alive.

  • other worlds pasted into or appended to each other.

The cells have no builtin rules regarding their evolution.

Evolver #

A GridWorld accepts an Evolver to push it through discrete evolutionary steps.

A ConwayEvolver is an Evolver embodying Conway's GOL rules with wrap-around boundary conditions. This evolver defines some static instances of small GridWorlds containing famous Conway GOL patterns, e.g. the Gosper glider gun:

static final gosperGliderGun = GridWorld.fromString('''
......................................
.........................#............
.......................#.#............
.............##......##............##.
............#...#....##............##.
.##........#.....#...##...............
.##........#...#.##....#.#............
...........#.....#.......#............
............#...#.....................
.............##.......................
......................................
''');

GridWorldIterable #

Extending Iterable<GridWorld>, this object combines a GridWorld and an Evolver such that one may evolve a world in an iteration context, e.g.

for (var w in GridWorldIterable(initialWorld, limit: 1000)) {
  render(w);
}

GridStringer #

A GridWorld can be converted to a string using a GridStringer.

GridStringerAnsi is a GridStringer that converts a world to a string with embedded ANSI escape sequences for animation on a terminal.

1
likes
40
pub points
0%
popularity

Publisher

verified publisherorangebike.dev

A cellular automaton library associated with a square grid. Includes Conway's Game of Life.

Repository (GitHub)
View/report issues

License

Apache-2.0 (LICENSE)

Dependencies

test, tuple

More

Packages that depend on grid_world