1.2.1 • Published 6 years ago

word-search-solver v1.2.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

word-search-solver

NodeJS module to solver word search puzzles

Allows you to solve word search puzzles by feeding it a matrix with the letters and the words to find

NPM version NPM downloads MIT License Build Status Coverage Status Greenkeeper badge

Installation

npm install word-search-solver

Usage

  const wordSearchSolver = require('word-search-solver');
  const matrix = [
    [ 'c', 'i', 'o', 't' ], 
    [ 'a', 'o', 'a', 'h' ], 
    [ 'u', 'b', 'w', 'z' ], 
    [ 'q', 'x', 'a', 'm' ], 
  ];
  const wordsToFind = [
    'bat',
    'cow',
    'max'
  ];

  const solution = wordSearchSolver(matrix, wordsToFind);

The output will be:

[
  {
    word: 'bat',
    found: true,
    firstLetter: [2, 1]
    lastLetter: [0, 3]
  },
  {
    word: 'cow',
    found: true,
    firstLetter: [0, 0]
    lastLetter: [2, 2]
  },
  {
    word: 'max',
    found: true,
    firstLetter: [3, 3]
    lastLetter: [3, 1]
  },
]

When one of the words is not found, it is returned like this:

  {
    word: 'love',
    found: false
  }

Tests

npm test

License

word-search-solver is freely distributable under the terms of the MIT license.

1.2.1

6 years ago

1.2.0

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago