node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »


genetic-phrase-solver Build Status

Generates desired text thru a genetic algorithm.


npm install genetic-phrase-solver


var solver = require('genetic-phrase-solver');
var generator = solver('Hello world!')
for(let str of generator) {
// Prints out something like: 
// !eWeo!HroWd! 
// !elrd Hllrd 
// Hrddo eolle 
// Hrddo eolle 
// Hrldo oerle! 
// Hrloo dlrle! 
// Heooo dlrle! 
// Heloo dlrle! 
// Helro Wlrle! 
// Helro Wlrle! 
// Heloo Wlrle! 
// Helro Worle! 
// Heloo Worle! 
// Heldo World! 
// Heloo World! 
// Hello World! 

solver(targetString, [charset])

Creates an ES6 generator that yields random strings that eventually evolve into the targetString. Initial random strings are generated from the characters in the targetString, but you can specify charset as a string of characters you want to generate initial random strings from.

Once the generator generates the targetString, it completes.