Git Product home page Git Product logo

capy's Introduction

CApy CApy icon

CApy is a 2D Cellular Automata fully implemented in Python based on Conway's Game of Life.

Author: Nicolas Palacio-Escat

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Usage

CApy is built as a GUI (graphical user interface) application using tkinter. It can either be opened by running the main.py script from a Python interpreter (any platform) or by opening the binary executable file you can find in the releases page (currently only for Linux). Note that if you are running from the Python interpreter, you need to install the required dependencies.

Interface example

The interface of CApy is pretty straightforward. First there is the graph space where the status of the CA is shown. Black cells are "alive" or "on" while the white ones represent "dead" cells or "off" state. The current iteration step is shown above this area. Just below you can find the figure toolbar where you can zoom, move, reset or even save the view of the current status. On the bottom of the window you can define the X/Y size of the grid as well as the initial number of cells. Here you can also define the speed as the time between iterations (in miliseconds) as well as the survival and birth rules (S/B, more on this below). Finally there are two buttons, "New" and "Play". The first generates a new state for the CA based on the parameters and rules provided. Cells are placed randomly across the available grid space following a uniform distribution without replacement (i.e. a cell cannot be positioned where another one already is). The "Play" button starts the simulation of the CA (or pauses it if it is currently running).

Rules

CA rules are defined by a list of digits between zero to eight. Each digit determines the number of alive neighbors of a given cell (Moore's neighborhood) where the rule applies. There are two main rules governing the behavior of the CA:

  • Birth (B): Dead cells that fulfill the given rule, will become alive in the next iteration, otherwise they remain dead.
  • Survival (S): Alive cells that fulfill the given rule will keep on living in the next iteration, they will die otherwise.

Therefore, for instance, Conway's Game of Life rules are B3/S23, which means:

  • Any dead cell surrounded by exactly three neighbors will become alive.
  • Any alive cell surrounded by either two or three neighbors will survive, otherwise will die.

Note that there can be empty rules, for example B/S012345678 will produce a static CA where cells with any number of neighbors survive but no new cells will be generated (birth rule is empty).

Dependencies


CC BY-SA 4.0

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.