Cellular Automata - Density Classification This project implements a 1D Cellular Automaton in C to solve the density classification problem, a classic computational problem in distributed systems.
📋 Features Supports arbitrary rule-based CA (e.g., Rule 30, Rule 157)
Simulates CA evolution over time (Stage 1)
Solves the density classification using a two-rule combination (Stage 2: Rules 184 & 232)
Neat CLI output formatted for debugging and result checking
🔧 How It Works Input:
CA size
Rule number (0–255)
Initial state (using * and .)
Number of updates, and cell tracking
Configuration for density classification
Stages:
Stage 0: Displays binary rules for the CA
Stage 1: Evolves the CA and counts ON/OFF cells
Stage 2: Uses Rules 184 and 232 to classify density
Output:
Printed CA grid after each timestep
ON/OFF cell counts
Final judgment on density compared to ½
bash gcc -o automata Program.c
Run using redirected input: bash ./automata < input.txt > output.txt
Sample input files (test0.txt, nikhil1.txt, etc.) and expected outputs are included for reference.
📁 Files Program.c – Main program logic
test0.txt, nikhil1.txt, nikhil2.txt – Sample input files
*.out.txt – Corresponding output examples
🧠 Concepts Rule-based CA evolution
Neighborhood-based binary transitions
Memory management in C
Density classification logic