See the RLE section for definition of RLE format.
This class expects the (extended) RLE input to be correctly formatted. It is a two state parser, thus multi-state RLE will not parse properly.
The output this.pattern
is a string with spaces(dead)/zero(alive)
with lines separated by '\n'.
As a convenience, the parse() function returns this.pattern
.
Install:
npm i gist:90396dbb8bd8670b4f39ca94ace48a20 --save
The parse(rleFileText) function returns this.pattern
containing spaces(dead) and zero(alive)
in a newline separated string.
const RLE = require('RLE-parser');
const rle = new RLE;
rle.parse(`
#C Example of glider
x = 3, y = 3
3o$o$bo!
`);
console.log(rle.pattern);
Expected result:
000
0
0