Coder Social home page Coder Social logo

syall / automata-gen Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 427 KB

A Cellular Automata Generator written in Typescript given initial rules, state transition rules, and running rules.

Home Page: https://automata-demo.syall.work/

TypeScript 100.00%

automata-gen's Introduction

automata-gen

Overview

automata-gen provides an easy framework (Automata Class) to generate Cellular Automata, including timing, size of the universe, maximum iterations, and more.

Features include difference between state and display, hooks to different parts of the running lifecycle, and simple design that requires no dependencies!

Motivation

Personally, Cellular Automata are a fascinating subject!

Although there are a lot of academic papers which discuss the various applications of this simple concept, there was no simple way to generalize and visualize creating cellular automata.

It should be noted that the generator is not able to generate every type of cellular automata, particularly cellular automata that involve "direction" of a cell (see Langton's Ant and the like).

Installation

To use this package using npm:

npm install automata-gen

or using yarn:

yarn add automata-gen

Usage

To create an Automata, three objects need to be defined:

  • InitialRules: The initial state of the automata with defined size (rows and columns) coupled with probability weights for cells or a two-dimensional array already populated.
  • StateRules, an array of Rules: The state transition function for a cell given information about neighbors and the cell's previous state, formatted (nbInfo, prev) => ....
  • RunningRules: The maximum number of iterations the automata should be run and the number of milliseconds between each iteration.

Use the constructor new Automata(initRules, stateRules, runningRules) to create an instance, and then use the generateGrid method if a predefined grid was not passed into initRules. After that, use the updateGrid method to iterate a single step or use the run method to run the automata based on runningRules.

Examples

The source code of popular automata can be found in the examples:

A Demo of these examples built in a React app can be found here.

Documentation

Further Documentation can be found here.

Personal Note

automata-gen is the first package I have felt confident enough to publish!

I have been learning how to code in my free time for several months now in addition to my computer science degree.

After using so much open source software, this would be my first contribution back to the computer science community.

Thank you,

syall

P.S. For those programmers that are coding Conway's Game of Life, you can make much more complex automata then that with this package for very little additional technical complexity.

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.