Cellular Automata, CA, in Python.
Project description
pyca
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
- Clone the code
- Install libraries:
pip install -r requirements.txt - Pick a script form
example/folder - 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
2D Cyclic AC
http://psoup.math.wisc.edu/mcell/rullex_cycl.html
Game of Life
https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
Rule30
https://en.wikipedia.org/wiki/Rule_30
Rule 110
https://en.wikipedia.org/wiki/Rule_110
Switch rules
Related projects
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycax-1.0.0.tar.gz.
File metadata
- Download URL: pycax-1.0.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6440b3af26cccafb08c1261b13c6859a4914412a92936cfd179227986ce613c7
|
|
| MD5 |
0578b77f6641eede99d81f909792eaa5
|
|
| BLAKE2b-256 |
d9b426baeec7bb8546ea02d98d9ac06deeeb36f240edab1a8c6879d6295df26b
|
File details
Details for the file pycax-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pycax-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad4ef59ea063dfe15a6d3bd10cbe109499deeaa23ef60aa8bc1be0bb5d3834a8
|
|
| MD5 |
7726b8437077da015b0eba209c7ac754
|
|
| BLAKE2b-256 |
46ccd051515ce1bb7b3b847e74597c9bac4515179e505c7990228037139aae34
|