src/lib/wordfind.js
function (words, options) {
            var puzzle = [], i, j, len;
            // initialize the puzzle with blanks
            for (i = 0; i < options.height; i++) {
                puzzle.push([]);
                for (j = 0; j < options.width; j++) {
                    puzzle[i].push('');
                }
            }
            // add each word into the puzzle one at a time
            for (i = 0, len = words.length; i < len; i++) {
                if (!placeWordInPuzzle(puzzle, options, words[i])) {
                    // if a word didn't fit in the puzzle, give up
                    return null;
                }
            }
            // return the puzzle
            return puzzle;
        }
function (words, options) {
            var puzzle = [], i, j, len;
            // initialize the puzzle with blanks
            for (i = 0; i < options.height; i++) {
                puzzle.push([]);
                for (j = 0; j < options.width; j++) {
                    puzzle[i].push('');
                }
            }
            // add each word into the puzzle one at a time
            for (i = 0, len = words.length; i < len; i++) {
                if (!placeWordInPuzzle(puzzle, options, words[i])) {
                    // if a word didn't fit in the puzzle, give up
                    return null;
                }
            }
            // return the puzzle
            return puzzle;
        }
function ( words , options ) { var puzzle = [ ] , i , j , len ; // initialize the puzzle with blanks for ( i = 0 ; i < options . height ; i ++ ) { puzzle . push ( [ ] ) ; for ( j = 0 ; j < options . width ; j ++ ) { puzzle [ i ] . push ( '' ) ; } } // add each word into the puzzle one at a time for ( i = 0 , len = words . length ; i < len ; i ++ ) { if ( ! placeWordInPuzzle ( puzzle , options , words [ i ] ) ) { // if a word didn't fit in the puzzle, give up return null ; } } // return the puzzle return puzzle ; }
Initializes the puzzle and places words in the puzzle one at a time.

Returns either a valid puzzle with all of the words or null if a valid
puzzle was not found.

@param {[String]} words: The list of words to fit into the puzzle
@param {[Options]} options: The options to use when filling the puzzle
Initializes the puzzle and places words in the puzzle one at a time .