Git Product home page Git Product logo

bitfield-rule30's Introduction

rule30

Version 0.6.1 (October 9, 2016)

rule30 is a collection of functions that implement Wolfram's Rule 30 cellular automaton and related transformations.

The Algorithm

Rule 30 is a one-dimensional two-state cellular automaton rule. The automaton consists of a sequence of symbols (sometimes thought of as a row of cells). Two states mean that the symbol can take one of two values (0 or 1), or, in other words, the corrssponding cell can be either "dead" or "alive". The state of the sequence is computed from the previous state. The state of a cell depends on the previous state of the cell itself, as well as the two neighbouring cells.

The rule is:

s'i = si-1 XOR (si OR si+1)

All possible inputs and outcomes are summarized below:

current state 000 001 010 011 100 101 110 111
new state 0 1 1 1 1 0 0 0

An important convention to be made here is that bits are numbered and showed from left to right. In binary representation, triplets 000 through 111 correspond to numbers 0 through 7.

Installation

To compile bitfield from source code:

$ autoconf
$ ./configure --prefix=DIRECTORY
$ make

The only compile-time and run-time dependency is Vitalie Ciubotaru's 'bitfield' library (version 0.4.*). If bitfield is not installed, or if the sources were configured with the '--with-local-bitfield' flag, make will assume that the source code of bitfield is available in the source tree (in 'bitfield' directory) and will attempt to build it first.

make builds a shared and a static library. For a shared or a static library only, do make shared or make static. make check runs some tests agains the newly-built library. make examples runs some examples with graphical output.

Functions

For function syntax, see "rule30.h". For details on every function, see its manual page.

rule30_parents_del() deletes a parents structure.

rule30_parents_new() creates an empty parents structure.

rule30_rev_bit() returns the four parent triplets of a bit (0 or 1)

rule30_rev_ring() treats the input array of bits as a ring and attempts to reverse-transform it by Wolfram's Rule 30.

rule30_rev_string() reverse-transforms an array of bits by Wolfram's Rule 30, and returns all possible parent combinations.

rule30_ring_ip() treats the input array of bits as a ring and transforms it by Wolfram's Rule 30 "in-place".

rule30_ring() treats the input array of bits as a ring and transforms it by Wolfram's Rule 30.

rule30_ringify() tests if an array of bits can be treated as a ring of given length and returns the resulting ring.

rule30_string_ip() transforms an array of bits by Wolfram's Rule 30 "in-place".

rule30_string() transforms an array of bits by Wolfram's Rule 30.

Please, see "examples" directory for working examples.

Licensing

rule30 is free software, and is released under the terms of the GNU General Public License version 3 or any later version. Please see the file called LICENSE.

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.