numeric-mastermind-solver-js
A better implementation for a step-by-step numeric mastermind solver than what I've found around
Features
- Works in node.js and in the browser.
- Included test suite and benchmark.
- Takes places and numbers as options
- Small: <1 KB minified and gzipped
Installation
node.js
Install using npm:
$ npm install numeric-mastermind-solver-js
Browser
Using bower:
$ bower install numeric-mastermind-solver-js
If you are not using any module loader system then the API will then be accessible via the window.Mastermind
object.
Examples
Node.JS
var Mastermind = ; var mm = ;var solution = 1234; // This is an automated example - you would typically try the guesses and feed the result pinsfor x = 0; x < 10; x++ var guess = mm; var res = Mastermind; mm; status = mmstatus; if statusstate === 'solved' // solved state break;
Browser
Building and Testing
To build the code and run the tests:
$ npm install -g grunt-cli$ npm install$ npm run build
Performance
You can run the benchmark yourself:
$ npm install -g grunt-cli$ npm install$ npm run build$ npm run benchmark
Contributing
If you wish to submit a pull request please update and/or create new tests for any changes you make and ensure the grunt build passes.
License
MIT - see LICENSE