modules/index.js
function(spec) {

            spec = spec || {};

            let aMask = spec.mask || [],
                start = spec.start || {},
                x = start.c || 0,
                y = start.r || 0;

            this.fill(0);

            for( var mKey in aMask ) {
                var mask = aMask[mKey];
                this.mask(mask.c,mask.r);
            }

            let maxDepth = this.xSize * this.ySize;

            this.carveMaze(x,y,0,maxDepth);

            // derived class can parse extra spec parameters

            this.afterGenerate(spec);

        }
function(spec) {

            spec = spec || {};

            let aMask = spec.mask || [],
                start = spec.start || {},
                x = start.c || 0,
                y = start.r || 0;

            this.fill(0);

            for( var mKey in aMask ) {
                var mask = aMask[mKey];
                this.mask(mask.c,mask.r);
            }

            let maxDepth = this.xSize * this.ySize;

            this.carveMaze(x,y,0,maxDepth);

            // derived class can parse extra spec parameters

            this.afterGenerate(spec);

        }
function ( spec ) { spec = spec || { } ; let aMask = spec . mask || [ ] , start = spec . start || { } , x = start . c || 0 , y = start . r || 0 ; this . fill ( 0 ) ; for ( var mKey in aMask ) { var mask = aMask [ mKey ] ; this . mask ( mask . c , mask . r ) ; } let maxDepth = this . xSize * this . ySize ; this . carveMaze ( x , y , 0 , maxDepth ) ; // derived class can parse extra spec parameters this . afterGenerate ( spec ) ; }
Generators a maze
@param {Object} options Named parameters for generating a maze
@param {Array} options.mask An array of cells to mask off from maze generation
@param {Array} options.open An array of objects designation what borders to open after generation
@param {Object} opions.start An object containing the x and y parameter of a cell to start maze generation from.
@function
@instance
@memberof module:maze-generator-core
@returns {boolean}
@example <caption>generate</caption>
maze.generate();
@example <caption>mask</caption>
let spec = {
mask: [
{ c: 2, r: 3 },
{ c: 2, r: 4 }
]
};
mazeGenerator.generate(spec);
@example <caption>start and mask</caption>
let spec = {
start: { c: 3, r: 3 },
mask: [
{ c: 0, r: 0 },
{ c: 0, r: 1 },
{ c: 1, r: 0 },
{ c: 1, r: 1 }
]
};
mazeGenerator.generate(spec);
Generators a maze