Skip to content

🐚 Returns new binary state of array after applying cellular automaton Rule 30

Notifications You must be signed in to change notification settings

jylopez/rule-30

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rule-30 npm version

Returns new binary state of array after applying cellular automaton Rule 30

Install

npm install rule-30

Usage

/*
Pass in binary array of length n (e.g. [0, 1, 0, 0]). Function returns an array of length n+2 after applying Rule 30.
pattern:                   111  110  101  100  011  010  001  000
new state of center value:  0    0    0    1    1    1    1    0
*/

var rule30 = require('rule-30');
console.log( rule30([0, 0, 1, 0, 1]) ) // [0, 0, 1, 1, 0, 1, 0]

API

rule30([array of 1s and 0s])

License

MIT

About

🐚 Returns new binary state of array after applying cellular automaton Rule 30

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published