Decodes cellular automata formats to [x1, y1, ..., xn, yn]
values. It currently supports the types rle
, plain
, and life
(1.05 and 1.06).
npm i ca-formats
Decodes a string of the given type into an array of interlaced cells.
decode.plain('.OO\nOO\n.O')
// [ 1, 0, 2, 0, 0, 1, 1, 1, 1, 2 ]
decode.rle('b2o$2ob$bo!')
// [ 1, 0, 2, 0, 0, 1, 1, 1, 1, 2 ]
See test/
for more examples.