Coder Social home page Coder Social logo

moh-maher / cellular_automata_projects Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.29 MB

C++ implementations for the basics of Wolfram's elementary 1D cellular automaton, and Conway's game of life

License: GNU General Public License v3.0

C++ 100.00%
cellular-automata gameoflife wolfram-mathematica

cellular_automata_projects's Introduction

Cellular Automaton Projects

This is a collection of c++ implementations for for the basics of Wolfram's elementary 1D cellular automaton, and Conway's game of life.

Wolfram's Elementary 1D Cellular Automaton

A grid of numbers describe the cell states of a given generation, ultimately considered as the “current” generation, 
and the mechanism by which we compute the next generation.  
For every cell in the grid:
  • Take a look at the neighborhood states: left, middle, right.

  • Look up the new value for the cell state according to some ruleset.

  • Set the cell’s state to that new value.

Examples:

compile ElementaryCA.cpp, run the executable file to select the targeted rule.

  • Rule 90: Alt text

  • Rule 126: Alt text

  • Rule 150: Alt text

  • Rule 182: Alt text

Game of Life

The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, 
each of which is in one of two possible states, alive (1) or dead (0). 
Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or 
diagonally adjacent. At each step in time, the following transitions occur:
  • Death. If a cell is alive (state = 1) it will die (state becomes 0) under the following circumstances.

    • Overpopulation: If the cell has four or more alive neighbors, it dies.

    • Loneliness: If the cell has one or fewer alive neighbors, it dies.

  • Birth. If a cell is dead (state = 0) it will come to life (state becomes 1) if it has exactly three alive neighbors (no more, no less).

  • Stasis. In all other cases, the cell state does not change. To be thorough, let’s describe those scenarios.

    • Staying Alive: If a cell is alive and has exactly two or three live neighbors, it stays alive.

    • Staying Dead: If a cell is dead and has anything other than three live neighbors, it stays dead

Example:

  • g++ GameOfLife.cpp and run the generated executable a.out file.

Alt text

Refrences

cellular_automata_projects's People

Contributors

moh-maher avatar

Watchers

 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.