A fundamental implementation of Rule 30 cellular automaton with parallel processing for educational and research purposes.
Rule 30 is an elementary cellular automaton introduced by Stephen Wolfram that exhibits complex, chaotic behavior from simple deterministic rules.
Mathematical Definition: Let
where
Binary representation:
The system exhibits:
- Chaos: Sensitive dependence on initial conditions
- Irreversibility: Information loss over time
- Complexity: Wolfram Class III behavior
This implementation provides basic tools for studying Rule 30:
- Parallel Numba JIT: Multi-core evolution for computational efficiency
-
Entropy Analysis: Shannon entropy
$H = -\sum p_i \log_2 p_i$ and local complexity - Complete Pyramids: Non-truncated patterns for boundary-free analysis
- NetCDF & CSV Output: Standard formats for data archiving and analysis
- Publication Figures: High-resolution plots (350-600 DPI)
From PyPI:
pip install batara-guruFrom source:
git clone https://github.com/sandyherho/batara-guru.git
cd batara-guru
pip install -e .Command line:
# Run single case (uses all CPU cores by default)
batara-guru case1
# Run all test cases
batara-guru --all
# Specify CPU cores
batara-guru case1 --cores 4
# Custom DPI
batara-guru case1 --dpi 600Python API:
from batara_guru import Rule30Solver
solver = Rule30Solver(width=501, steps=250, n_cores=8)
result = solver.evolve(initial_condition='single')
print(f"Final entropy: {result['entropy'][-1]:.4f}")
print(f"Mean complexity: {result['mean_complexity']:.4f}")Provided test cases for pedagogical purposes:
| Case | Description | Width | Steps | DPI | Purpose |
|---|---|---|---|---|---|
| 1 | Small | 251 | 125 | 350 | Quick demonstration |
| 2 | Medium | 501 | 250 | 400 | Standard analysis |
| 3 | Large | 1001 | 500 | 500 | High-detail study |
| 4 | Extra Large | 2001 | 1000 | 600 | Publication quality |
All cases maintain
Example configuration file:
grid_width = 501 # Number of cells
time_steps = 250 # Evolution steps (< width/2 for full pyramid)
initial_condition = single # Single center cell (standard)
center_position = 250 # Auto-calculated if not specified
plot_dpi = 400 # Output image resolution
save_netcdf = true # Save NetCDF file
save_plot = true # Save PNG plot
colormap = binary # Color scheme
For each simulation, the following files are generated:
NetCDF (.nc):
-
grid(time, x): Complete evolution history -
entropy(time): Shannon entropy$H(t)$ -
complexity(time): Normalized transition density
CSV (.csv):
{scenario}_entropy.csv: Time series of entropy values{scenario}_complexity.csv: Time series of complexity values{scenario}_composite.csv: Combined entropy and complexity
PNG (.png):
- Spatio-temporal visualization of evolution
Shannon Entropy:
Local Complexity:
Utilizes all available CPU cores by default. Override with:
batara-guru case3 --cores 8Or programmatically:
solver = Rule30Solver(width=1001, steps=500, n_cores=8)If this tool is useful for your research or teaching, please cite:
@software{batara_guru_2025,
author = {Herho, Sandy H. S. and Napitupulu, Gandhi},
title = {\texttt{batara-guru}: Python-based Rule 30 cellular automaton analyzer},
year = {2025},
version = {0.0.1},
url = {https://github.com/yourusername/batara-guru},
license = {MIT}
}- Sandy H. S. Herho (sandy.herho@email.ucr.edu)
- Gandhi Napitupulu
MIT License - See LICENSE for details.
This is an educational implementation inspired by Wolfram's pioneering work on cellular automata. For comprehensive cellular automata research, see Wolfram's A New Kind of Science.