More examples can be found in the models folder.
The MJr program can then be used by calling its main function, which has the following signature:
function main(width: int, height: int, rng?: PRNG): Grid;
The return value is a
Grid object with the following properties:
height: the grid dimensions
data: the grid cells, as a flat array of unsigned integers in row-major order.
alphabet: a string mapping the values in
datato the alphabet symbols used in the MJr source code.
Grid objects can also be converted to strings for display.
rng parameter is optional; if provided, it must be an object with a
nextDouble method returning a random floating-point value in the half-open interval
[0, 1), and a
nextInt method accepting a positive integer
n and returning a random integer in the half-open interval
[0, n). If not provided, a default unseeded algorithm is used.
See the documentation and implementation notes for more information.