Jotto solver.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
test
.eslintrc.js
.gitattributes
.gitignore
.travis.yml
LICENSE.txt
README.md
index.js
package.json

README.md

jotto

Build Status Dependency Status

Jotto solver.

Example

With a JSON file of previous guesses and their scores:

{
  "bread": 1,
  "anvil": 2
}

Pipe it into jotto to get the best possible next guess:

$ jotto < guesses.json

    Imported : 12,478 words
       Using :  8,013 words
    Possible :    935 words
  Best guess : irone

Installation

For the jotto command-line executable:

$ npm install -g jotto

For programmatic usage:

$ npm install jotto

API

var jotto = require('jotto');

jotto.narrowDownPossibleWords(words, previousGuesses)

Given an Array words of words and an Object previousGuesses like this:

{
  'bread': 1,
  'anvil': 2
}

...wherein each key is a guess and each value is the score (in jots) that the guess received, narrows down the possible solutions to the current puzzle and returns the narrowed-down Array of words.

jotto.bestGuess(words, possibleWords)

Given the Array words that you used for jotto.narrowDownPossibleWords and the Array possibleWords that was returned, returns the word that would narrow down the possible words the most (the "best guess").