Code Monkey home page Code Monkey logo

opencv-cellular-automata's Introduction

cellular automata

This project has two dependencies cxxopts and opencv

Build the project by creating a build directory in the root directory of the project and using cmake

mkdir build && cd build
cmake ..
make

Once successfully built you can specify a rule between 0 and 254 for the cellular automata

./ca.app --rule 30

The program will run and output a png file showing the output of the cellular automata, you can also build all rules with the —all flag

./ca.app --all

Cellular Automata ( CA ) are simple machines that work on a tape, they see a limited view of their tape and follow a few set rules.

They vary in breadth of vision and complexity but simple CA can create complex patterns.

An interesting subset of CA can see only three objects at a time, each object can have two states 1 or 0 and each state has an associated rule.

The task of the CA at each step along its tape is to assess its environment and make a decision, whether to assign its value 1 or 0.

decision

The CA’s decision is determined by the state of the objects in its view and its rule set, the objects in view each have two possible states so there are 2^3 unique combinations of state that these three object's can be in, giving 8 in total.

The rule set provides a 1 or 0 value for each of these 8 possible states, giving 2^8 possible sets of rules, 255 unique rules in total.

Each ruleset number's binary representation lays out the value to be assigned

rule 1

Rule 1 matches a 1 value only when all three cells in view have a value of 0, any cell with a 1 value will result in a 0 value being assigned, iterating this over rows viewed three cells at a time produces a pattern.

Some rulesets are more interesting than others, some produce regular patterns, some just look like white noise but others create patterns seemingly on the border between predictable structure and noise.

For example rule 126 produces a mixture of repeating motifs, not predictable but not entirely random either.

rule 126

rule 126

opencv-cellular-automata's People

Contributors

niallmcginness avatar

Watchers

James Cloos avatar  avatar

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.