word-puzzle-shuffler
v1.0.10
Published
shuffle given two words properly so user can find out the word into the puzzle
Downloads
4
Maintainers
Readme
Word Puzzle Shuffler
A simple package to shuffle given two words properly to the 3 x 3 matrices.
Table of Contents
Usage
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"]
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]
]
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]
]
TODO
- Improve the code so this package would work with (n x m ) matrices.
- Add tests included edge cases.