CellularAutomata.NET 10.0.0.2

dotnet add package CellularAutomata.NET --version 10.0.0.2
                    
NuGet\Install-Package CellularAutomata.NET -Version 10.0.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CellularAutomata.NET" Version="10.0.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CellularAutomata.NET" Version="10.0.0.2" />
                    
Directory.Packages.props
<PackageReference Include="CellularAutomata.NET" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CellularAutomata.NET --version 10.0.0.2
                    
#r "nuget: CellularAutomata.NET, 10.0.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CellularAutomata.NET@10.0.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CellularAutomata.NET&version=10.0.0.2
                    
Install as a Cake Addin
#tool nuget:?package=CellularAutomata.NET&version=10.0.0.2
                    
Install as a Cake Tool

CellularAutomata.NET

Lightweight framework for generating cellular automata in .NET.

wolfram3d.gif
<sub>Rule 30 in 3 dimensions.</sub>

Nuget

You can install the CellularAutomata.NET package via NuGet:

dotnet add package CellularAutomata.NET

Examples

The following examples are included in the project:

  • Wolfram.csproj ⇒ Rule 30
  • Conway.csproj ⇒ Game of Life.
  • Wolfram3D.csproj ⇒ Rule 30 extruded to 3 dimensions. Rendered with SILK.Net
  • ReverseRuleBuilder.csproj ⇒ Example/research of reversing out the rules that match a given state for a 5 cell elementary automata

Usage

This framework allows for N-dimensional cellular automata. The limit varies based on your SIMD limitation for vectors.

Each automata has a Rule function which is applied to each cell each step. From Conway's Game of Life example:

public static readonly Action<
	CellularAutomataCell<int>,
	Dictionary<Vector<int>, CellularAutomataCell<int>>,
	CellularAutomata<int>
	> Rules = new Action<
	CellularAutomataCell<int>,
	Dictionary<Vector<int>, CellularAutomataCell<int>>,
	CellularAutomata<int>
>(
	(cell, neighbors, automata) =>
	{
		// https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life#Rules
		if (neighbors.Count == 0)
		{
			return;
		}
		int livingNeighbors = neighbors.Sum(t => t.Value.State);
		if (cell.State == 1)
		{
			if (livingNeighbors < 2 || livingNeighbors > 3)
			{
				cell.SetState(0);
			}
		}
		else if (livingNeighbors == 3)
		{
			cell.SetState(1);
		}
		else
		{
			cell.SetState(0);
		}
	}
);

The Func passes the cell being examined, a dictionary of its neighbors (with their relative positions) and the automata that called the function.

In this example, we look at the neighbors of our cell and sum up their State values.

The next piece of an automata is its configuration.

CellularAutomataConfiguration<int> config = new CellularAutomataConfiguration<int>
{
	new CellularAutomataDimension { Cells = 48 },
	new CellularAutomataDimension { Cells = 48 },
	DefaultState = 0
};

We specify the two dimensions of our grid and the default state of a cell. Dimensions contain properties for WrappedStart and WrappedEnd, but for this Game of Life we're not wrapping.

We'll also use the predefined Moore neighborhood. This simplifies the process of starting up our automaton. You can reference the Wolfram example for a custom neighborhood configuration.

CellularAutomata<int> automaton = new CellularAutomata<int>(
	config,
	CellularAutomataNeighborhood<int>.MooreNeighborhood,
	Rules
	);

Now we set our initial state and start steppin'.

Dictionary<System.Numerics.Vector<int>, int> initialState = new Dictionary<
    System.Numerics.Vector<int>,
    int
>()
{
    /*
     * Glider at 0,0
     * 1 0 0
     * 0 1 1
     * 1 1 0
     */
    { AutomataVector.Create(0, 0), 1 },
    { AutomataVector.Create(1, 1), 1 },
    { AutomataVector.Create(2, 1), 1 },
    { AutomataVector.Create(0, 2), 1 },
    { AutomataVector.Create(1, 2), 1 },
};

// Glider moves one cell to the right every 4 steps.
// We are moving width - the length of the glider, so 45 total along the x-axis.
int stepsToEnd = 45 * 4;

automaton.InitializeGrid(initialState);

int step = 0;
while (step <= stepsToEnd)
{
    Console.WriteLine($"Step {step++}/{stepsToEnd}\n{automaton.Grid}");
    automaton.Step();
}

conway.gif

Voila!

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.0.2 136 12/21/2025
10.0.0.1 129 12/21/2025
10.0.0 136 12/21/2025