# One dimensional Cellular Automata

## Discrete Cellular Automata

`CellularAutomata.DCA`

— Type`DCA(rule; states=2, radius=1)`

Creates a `DCA`

object given a specific rule. It automatically computes the ruleset for the provided rule, number of states, and radius.

**Arguments**

`rule`

: The rule identifier used for the cellular automaton's evolution.`states`

(optional): The number of possible states for each cell. Defaults to 2.`radius`

(optional): The neighborhood radius around each cell considered during the evolution. Defaults to 1.

**Usage**

`dca = DCA(30; states=2, radius=1) # Creates a DCA with rule 30, 2 states, and radius 1.`

Once instantiated, the `DCA`

object can evolve a given starting array of cell states through its callable interface:

```
dca = DCA(110; states=2, radius=1) # Initialize with rule 110, 2 states, and a radius of 1
starting_array = [0, 1, 0, 1, 1, 0] # Initial state
next_generation = dca(starting_array) # Evolve to the next generation
```

`CellularAutomata.TCA`

— Type`TCA(code; states=2, radius=1)`

Constructs a Totalistic Cellular Automaton (TCA) with a specified code, number of states, and neighborhood radius. It automatically computes the codeset for the provided code and configuration, which is used for the automaton's evolution.

**Arguments**

`code`

: An integer or string representing the rule code for the automaton's evolution.`states`

(optional): The number of possible states for each cell. Defaults to 2.`radius`

(optional): The neighborhood radius around each cell considered during the evolution. Defaults to 1.

**Usage**

`tca = TCA(30; states=2, radius=1) # Creates a TCA with rule code 30, 2 states, and radius 1.`

After instantiation, the `TCA`

object can be used to evolve a given starting array of cell states:

```
# Initialize TCA with a specific code, default states, and radius
tca = TCA(102; states=3, radius=1)
# Example starting state: a 1D array of cells
starting_array = [0, 2, 1, 0, 1, 2]
# Compute the next generation
next_generation = tca(starting_array)
```

## Continuous Cellular Automata

`CellularAutomata.CCA`

— Type`CCA(rule; radius=1)`

Create a Continuous Cellular Automaton (CCA) object.

**Arguments**

`rule`

: A numeric code defining the evolution rule for the cellular automaton.`radius`

(optional): The radius of the neighborhood around each cell considered for its update at each step. Defaults to`1`

.

**Returns**

`CCA`

: A `CCA`

object initialized with the given rule and radius.

**Examples**

`cca = CCA(0.5)`

Once created, the `CCA`

object can be used to evolve a given starting array of cell states:

```
cca = CCA(0.45; radius=1) # Initialize with rule 0.45 and default radius
starting_array = [0, 1, 0, 1, 0.5, 1] # Initial state
next_generation = cca(starting_array) # Evolve to next generation
```

The evolution is determined by the rule applied to the sum of the neighborhood states, normalized by their count, for each cell in the array.