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

outdated

A toolkit for playing with Conway's Game of Life at the command line.

GridWorld #

A set of dart classes for playing with Conway's Game of Life at the command line.

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

There are three primary interfaces: GridWorld, Evolver and GridStringer.

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.

    .....
    ..#..
    ..#..
    ..#..
    .....
    

    where . means dead, and anything else means alive.

  • other worlds pasted into or appended to each other.

Evolver #

A GridWorld accepts an Evolver to evolve it forward in time.

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

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

GridStringer #

A world 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
0
pub points
0%
popularity

Publisher

verified publisherorangebike.dev

A toolkit for playing with Conway's Game of Life at the command line.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

test

More

Packages that depend on grid_world