No Problem, Meatbag


    0.1.2 • Public • Published


    A word search generator


    var generator = require('@sbj42/word-search-generator');
    var puzzle = generator();;','));

    That might print:

    H T E S A D A N W O
    A O W O R T R U N K
    R E A D I O M P I G
    D T O W D L Y D A M
    L G I S E D H C A E
    Y N O N D R R O C K
    D C U D U A I Y N L
    K T A T O D Y C E O
    J U D G E O O T H U
    E H T O B P R G W D


    The generator function takes an optional options object, with these options:

    diagonals (boolean)

    Defaults to true. Determines whether words can be placed diagonally on the puzzle.

    width and height (integer)

    Defaults to 10x10. Sets the size of the puzzle.

    minLength and maxLength (integer)

    Useful for making sure the words aren't too short or too long. The default for minLength is 3, and for maxLength is undefined.

    words (array of strings)

    Words will be chosen randomly from this list. If this is not provided, it uses a built-in set of around 2,000 words.

    puzzle api

    The object returned from the generator function has the following properties:

    width and height (integer)

    The size of the puzzle.

    grid (array of string)

    The letters in the puzzle. For row R and column C, the letter can be found at grid[R * width + C].

    words (array of string)

    The words placed in the puzzle, in alphabetical order.

    get(C, R)

    A helper function to fetch the letter at row R and column C.


    Prints the puzzle to a string, for testing or command-line output.


    npm i @sbj42/word-search-generator

    DownloadsWeekly Downloads






    Unpacked Size

    26.3 kB

    Total Files


    Last publish


    • sbj42