1.0.10 • Published 4 years ago

word-puzzle-shuffler v1.0.10

Weekly downloads
12
License
MIT
Repository
github
Last release
4 years ago

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"]

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.
1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago