Skip to main content

Awesome cellular automata created by Borja Esteban

Project description

ndAutomata

codecov CI

Awesome cellular automata library created by Borja Esteban.

Install it from PyPI

pip install ndautomata

Usage

This package is designed in order to create your own automata definitions based on 2 attributes:

  • neighbours: List with relative indexes to cell neighbours.
  • states: Number possible cell states.
from ndautomata import BaseAutomaton, neighbours

class Automaton(BaseAutomaton):
    neighbours = neighbours.regular(ndim=1, r=1)
    states = 2

Note the automata dimensions are defined with neighbours.ndim.

After you have defined your automaton, you can instantiate automata passing the initial configuration and the rule to the constructor function. Use the module initializers, based on numpy to generate the required arrays passing the number of states and size.

from ndautomata import initializers

rule = initializers.random(states=2, size=[2, 2, 2])
ic = initializers.center(states=2, size=[100])
ca = Automaton(ic, rule)

Note the shape of the rule must always be [states] * neighbours.size.

See examples for more detailed use cases and examples on how to generate some plots.

Development

Fork the repository, pick one of the issues at the issues and create a Pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ndautomata-0.1.0.tar.gz (23.5 kB view hashes)

Uploaded Source

Built Distribution

ndautomata-0.1.0-py3-none-any.whl (17.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page