Wondering what’s next for npm?Check out our public roadmap! »

    word-puzzle-shuffler

    1.0.10 • Public • Published

    Word Puzzle Shuffler

    Build Status npm version GitHub repo size Greenkeeper badge

    A simple package to shuffle given two words properly to the 3 x 3 matrices.

    Table of Contents

    Usage

    npm install word-puzzle-shuffler

    const shuffle = require('word-puzzle-shuffler')

    const shuffledData = shuffle(['wordA: string, wordB: string])

    shuffledData.getCellValues

    getCellValues returns an array which includes shuffled letters from 0 - 9 indexes, Total length of the two words have to be 9 to fit in 3 x 3 matrices.

    const shuffledData = shuffle(['LEMON', 'PEAR']);

    const cellValues = shuffledData.getCellValues;

    ["E","N","O","A","P","M","R","E","L"]

    proper cells value

    shuffledData.getFirstWordIndexes

    getFirstWordIndexes returns an array which provides indexes of the first word in 3 x 3 matrices.

    const firstWordIndexes = shuffledData.getFirstWordIndexes;

    [
        [2,2],
        [2,1],
        [1,2],
        [0,2],
        [0,1]
    ]
    

    first word indexes

    shuffledData.getSecondWordIndexes

    getSecondWordIndexes returns an array which provides indexes of the second word in 3 x 3 matrices.

    const secondWordIndexes = shuffledData.getSecondWordIndexes;

    [
        [1,1],
        [0,0],
        [1,0],
        [2,0]
    ]
    

    second word indexes

    TODO

    • Improve the code so this package would work with (n x m ) matrices.
    • Add tests included edge cases.

    Install

    npm i word-puzzle-shuffler

    DownloadsWeekly Downloads

    12

    Version

    1.0.10

    License

    MIT

    Unpacked Size

    28.6 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar