Socket
Socket
Sign inDemoInstall

numeric-mastermind-solver-js

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    numeric-mastermind-solver-js

Numeric mastermind step-by-step guesser and solver


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
11.1 kB
Created
Weekly downloads
 

Readme

Source

numeric-mastermind-solver-js

Build Status

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 = require('numeric-mastermind-solver-js');

var mm = new Mastermind();
var solution = 1234;

// This is an automated example - you would typically try the guesses and feed the result pins
for (x = 0; x < 10; x++) {
  var guess = mm.getGuess();
  var res = Mastermind.matchPins(solution, guess);
  mm.feedPins(res.green, res.blue);
  status = mm.status();
  if (status.state === 'solved') {
    // solved state
    break;
  }
}

Browser

See examples/browser.html

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

Keywords

FAQs

Last updated on 13 Mar 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc