0.1.4 • Published 10 years ago
binary-breeder v0.1.4
binary-breeder
Breeds the specified number of offspring from two parent strings of binary digits with the possibility of random mutation.
Installation
npm install binary-breeder
Dev Setup
npm install -g mocha
npm install -g istanbulUnit Tests
npm testCoverage
npm run coverUsage
var reproduce = require('binary-breeder');
var numOffspring = 5;
var mutationChance = 0.002;
var parentChromosomes = [
'000011001101100101',
'110010100110110100'
];
var offspring = reproduce(parentChromosomes, numOffspring, mutationChance);
/*
sample output
[ '000010100110110100',
'110011001101100101',
'110010100111100101',
'000011001101110100',
'110011001101100101' ]
*/