cellular-automata-class-0.0.4
توضیحات
An expandable cell class intended for constructing Cellular Automata
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | cellular-automata-class-0.0.4 |
| نام | cellular-automata-class |
| نسخه کتابخانه | 0.0.4 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Jafar Isbarov |
| ایمیل نویسنده | cefer.isbarov@gmail.com |
| آدرس صفحه اصلی | https://github.com/ceferisbarov/cellular-automata-class |
| آدرس اینترنتی | https://pypi.org/project/cellular-automata-class/ |
| مجوز | - |
# Cell class for Cellular Automata
https://test.pypi.org/project/cellular-automata-class/
# Installation
`pip install cellular-automata-class`
# Usage
Import the class as:
```python
from cellular_automata_class import cell
```
It can be used to set up a lattice:
```python
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:
```python
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
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl cellular-automata-class-0.0.4:
pip install cellular-automata-class-0.0.4.whl
نصب پکیج tar.gz cellular-automata-class-0.0.4:
pip install cellular-automata-class-0.0.4.tar.gz