binary-breeder

0.1.4 • Public • Published

binary-breeder

Breeds the specified number of offspring from two parent strings of binary digits with the possibility of random mutation.

npm Coverage Status Build Status

Installation

npm install binary-breeder

Dev Setup

npm install -g mocha
npm install -g istanbul

Unit Tests

npm test

Coverage

npm run cover

Usage

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' ]
*/

Package Sidebar

Install

npm i binary-breeder

Weekly Downloads

6

Version

0.1.4

License

MIT

Last publish

Collaborators

  • rmrxp808