An expandable cell class intended for constructing Cellular Automata
Project description
Cell class for Cellular Automata
https://test.pypi.org/project/cellular-automata-class/
Installation
pip install cellular-automata-class
Usage
Import the class as:
from cellular_automata_class import cell
It can be used to set up a lattice:
def set_lattice(length, choice):
'''
Given the choice of lattice pattern, sets a 2 dimensional, finite lattice,
digits of which store a cell each
'''
lattice = []
for n in range(length):
lattice.append([])
for x in range(length):
for y in range(length):
lattice[x] += [Cell(1,x,y) if x == math.floor(length/2) else Cell(0,x,y)]
return lattice
In order to "play" the lattice, we need to iterate through the whole lattice calling cell.evaluate()
method:
def play(lattice, evaluation_count):
for n in range(evaluation_count):
lattice_copy = copy.deepcopy(lattice)
for x in lattice:
for y in x:
y.evaluate(lattice_copy)
The class can be expanded in various ways. E.g. we can add stochastic element to it, we can add new neighborhood types, etc.
Troubleshooting
Contribute
References
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
Built Distribution
File details
Details for the file cellular_automata_class-0.0.4.tar.gz
.
File metadata
- Download URL: cellular_automata_class-0.0.4.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2947968a94b5ac33bb782083413284084280558ec28b5489cde6344438abb1e0 |
|
MD5 | d33d0d7c43c8b3335e233d1bcb42cb2d |
|
BLAKE2b-256 | 2ca5f88fea67deee3dcdac4385ce1eb3c25937efbdfcb6b96d597e99ca75c1c4 |
File details
Details for the file cellular_automata_class-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: cellular_automata_class-0.0.4-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f54ebe4a86e07b581ce14abe265dfe6d7f2a09b934b77ce618c942b2000e6e7d |
|
MD5 | fb634e9fb709f4c64e9854ec44d2e1a3 |
|
BLAKE2b-256 | a71ff028790812b478229bcb38fa7307aa01e041ef95436f5fe954508f6db086 |