Skip to main content

logo

pyca

Build Status

Cellular Automata, CA, in Python.

Features

  • easy to add new rules, check Rule30
  • you can even witch rules during compute
  • multiple dimensions universes (1d and 2d) support
  • support multiply cell types in one universe
  • support customized neighbour search
  • unit tests (more is coming)

Get started

See something running

  1. Clone the code
  2. Install libraries: pip install -r requirements.txt
  3. Pick a script form example/ folder
  4. Magic...

Explore the code

from pyca.universe1d import Universe1D
from pyca.rules.Rules import Rule30
from pyca.observer import plot1d_universe

universe = Universe1D(300)
universe.register_cell_type(Rule30, 'random', prob=0.5)
universe.initialize()
universe.compute(300)
plot1d_universe(universe)

Or for classic rulexxx system, you can just pus a str represent rule for ClassicRule!

from pyca.universe1d import Universe1D
from pyca.rules.BaseRule import ClassicRule
from pyca.observer import plot1d_universe

size = 600
universe = Universe1D(size)
universe.register_cell_type(ClassicRule, 'single', pos=size-1, rule='01101110')  # Rule110 here
universe.initialize()
universe.compute(size)
plot1d_universe(universe)

Concepts

  • Universe, contains all the cells, and function to trigger computation
  • CellType, rule of the cell is defined here
  • observer, way to observe universe, well it can be visual, but it can also be something else, like sounds!

Currently, 2 2D universe is supported, you can define a CA by injecting a new type of CellType.

Road map

  • 3D universe
  • HyperGraph Universe
  • Interactive Observers
  • Musical Observers

Examples:

Rule 0 - Rule 255

pngs

2D Cyclic AC

http://psoup.math.wisc.edu/mcell/rullex_cycl.html

code

2D Cyclic AC

Game of Life

https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

Code

A random game of life

Rule30

https://en.wikipedia.org/wiki/Rule_30

Code

Rule 30

Rule 110

https://en.wikipedia.org/wiki/Rule_110

Code

Rule 110 ani

Rule 110

Switch rules

Code

Switch Rules

Related projects

Metadata

Release files for pycax 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycax 1.0.0
File Size Uploaded Provenance Actions
pycax-1.0.0.tar.gz 9.4 kB Without provenance Details for pycax-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pycax 1.0.0
File Interpreter ABI Platform Actions
pycax-1.0.0-py3-none-any.whl Python 3 none any Details for pycax-1.0.0-py3-none-any.whl

Total release size: 22.3 kB

Release files / pycax-1.0.0.tar.gz

Download URL pycax-1.0.0.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6440b3af26cccafb08c1261b13c6859a4914412a92936cfd179227986ce613c7
BLAKE2b-256 checksum
How to use checksums
d9b426baeec7bb8546ea02d98d9ac06deeeb36f240edab1a8c6879d6295df26b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.2

Release files / pycax-1.0.0-py3-none-any.whl

Download URL pycax-1.0.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad4ef59ea063dfe15a6d3bd10cbe109499deeaa23ef60aa8bc1be0bb5d3834a8
BLAKE2b-256 checksum
How to use checksums
46ccd051515ce1bb7b3b847e74597c9bac4515179e505c7990228037139aae34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.2

Security for pycax 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page