Code Monkey home page Code Monkey logo

eca's Introduction

Elementary Cellular Automata

A generator written in Javascript for Elementary Cellular Automata. We call it eca. Made by Mund & Mart for their profielwerkstuk.

Usage

eca(rule, options) has one required parameter(the rule),the second parameter is optional. The rule can be a base 10 integer or an binary string. The second parameter is an object. That object can contain a seed. The seed is a binary string. The seed defaults to '1'. You can also determine the width of the eca. The width property defaults to 11. The .genLattice() method generates a new lattice and returns that lattice. A lattice is an binary string. The lattices are saved in the .lattices property. You can also use the .generateLattices(n) method to generate multiple lattices at once. This returns an array with the created lattices.

Examples:

const eca = require('eca')

const thirty = eca(30)
thirty.genLattice() // => '00001110000'
thirty.genLattice() // => '00011001000'
thirty.genLattice() // => '00110111100'
thirty.lattices
// => [ '00000100000', '00001110000', '00011001000', '00110111100' ]

A custom eca:

const custom = eca('00111001', {seed: '1001', width: 4})
custom.generateLattices(3) // => [ '0100', '0011', '1011' ]
custom.lattices
// => [ '1001', '0100', '0011', '1011' ]

Installation

npm i eca

eca's People

Contributors

2990louis avatar mundvetter avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

2990louis

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.