Skip to content

FuriousFist/Cellular-Automata-Simulation-and-Density-Classification-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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 ½

▶️ How to Run Compile with any standard C compiler:

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

About

A C implementation of 1D Cellular Automata to explore rule-based evolution and solve the density classification problem. Includes CLI-based simulation and sample inputs/outputs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages