GithubHelp home page GithubHelp logo

luciopaiva / automaton-lab Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 80 KB

A 2D cellular automata sandbox where rules can be changed on-the-fly through an embeded script editor.

Home Page: https://luciopaiva.com/automaton-lab

HTML 29.19% JavaScript 70.81%
cellular-automata vanilla-javascript visualization simulation grid neighbors transition

automaton-lab's Introduction

Automaton Lab

A 2D cellular automata sandbox where rules can be changed on-the-fly through an embeded script editor.

At each simulation update, each cell (i.e., represented by a block in the grid) decides its next state based on its neighbors' and its own current state. During its update phase, a cell can only modify its next state and nothing more. So, for instance, to simulate something falling, one has to code it with two state changes:

? ? ?
? a ? => .
? . ?

? a ?
? . ? => a
? ? ?

In each 3x3 grid above, the central symbol represents the cell to be evaluated and the surrounding symbols represent its neighbors. An arrow indicates to which state the cell should transition when that arrangment matches its current state. ? symbols simply mean that cell state doesn't take part in the decision. a reprents some block in the world, while . represents space in this context (but it's really just another block and nothing more).

Thus, in the first grid, if the cell's state is a and the cell below is empty (i.e., .), a will transition to a . in the next global state. Complementarily, the second grid commands an empty cell to become an a if there's an a above it in the current state. When those two rules are executed, this happens:

. . . . .      . . . . .
. a . . .      . . . . .
. . . a .  =>  . a . . .
. . . . .      . . . a .
. . . . .      . . . . .

Giving the impression that all as are falling.

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.