A library for creating and running dynamic systems, such as cellular automata, using the MOMA (Moving Origin Modular Arithmetic) framework as the core update rule.
This crate provides the tools to build simulations where the evolution of the system is governed by the complex, non-linear, and deterministic patterns generated by MOMA.
Most simulations, like cellular automata, use simple, fixed rules to determine the next state of a cell (e.g., "if the left neighbor is black and the right is white, the new cell is black").
The MOMA Simulation Engine replaces these simple rules with a MomaRing. The state of a cell evolves based on the MOMA residue of its current state, where the "moving origin" is determined by the state of its neighbors.
This introduces a rich, complex, and deeply interconnected dynamic, allowing for the generation of intricate and emergent patterns that are unique to the chosen MOMA strategy.
CellularAutomaton: A simple 1D cellular automaton that uses MOMA for its update logic.- Strategy-Driven Rules: The behavior of the simulation is determined by the
OriginStrategypassed to it. This means you can create vastly different "universes" just by changing the strategy. - Extensible: Designed to be a foundation for more complex simulations, such as 2D automata or dynamic graph-based systems.
To use this engine in your own project, add it to your Cargo.toml.
[dependencies]
moma_simulation_engine = "0.3"or run:
cargo add moma_simulation_engineHere is a simple example of how to create, run, and display a MOMA-powered cellular automaton.
use moma::strategy;
use moma_simulation_engine::automaton::CellularAutomaton;
use std::{thread, time};
fn main() {
println!("--- MOMA-Powered 1D Cellular Automaton ---");
// --- Simulation Parameters ---
let width = 100; // Width of the automaton in cells.
let steps = 200; // Number of generations to simulate.
let modulus = 10; // The number of states for each cell (0-9).
let delay_ms = 50; // Delay between steps for visualization.
// Choose a MOMA strategy to govern the rules.
// Try changing this to `strategy::PrimeGap` to see a different universe!
let strategy = strategy::CompositeMass;
// --- Initialization ---
let mut automaton = CellularAutomaton::new(width, modulus, strategy);
println!("Initial State (Generation 0):\n{}\n", automaton.render());
// --- Simulation Loop ---
for i in 1..=steps {
automaton.step();
println!("Generation {}:", i);
println!("{}", automaton.render());
thread::sleep(time::Duration::from_millis(delay_ms));
}
println!("\n--- Simulation Complete ---");
}The examples are best thought of as two groups: stable, educational examples and research-oriented experiments.
- moma_automaton - Minimal 1D cellular automaton showing the core MOMA update loop.
- moma_conways_game_of_life - A visual 2D MOMA-driven Conway-style simulation.
- moma_pathfinder - Maze generation plus A* solving, useful as a clean pathfinding baseline.
- moma_dynamic_pathfinder - A dynamic A* example where terrain evolves based on MOMA state.
- moma_gower - Experimental path-analysis work using Gowers-style complexity as a feedback signal.
- moma_network_flow_manager - A higher-level systems example for resilience and adaptive flow management.
- moma_agent_behavioural_analysis - Strategy comparison experiments for agent behavior and path trade-offs.
- moma_quantum_simulator - An educational quantum circuit demo built from first principles.
This split keeps the crate approachable while preserving the more speculative projects that motivated the original research direction.
Neil Crago
This project is licensed under either of:
- Apache License, Version 2.0
- MIT license
at your option.
This crate is part of a collection of crates by the same author: These include:-
- MOMA
- Fractal_Algebra
- tma_engine
- factorial_engine
- fa_slow_ai