Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::CA::Critters_Rule Class Reference

Critters reversible CA block rule. More...

#include <tpl_ca_block_rule.H>

Public Member Functions

template<typename State >
constexpr Block_2x2< State > operator() (const Block_2x2< State > &in) const noexcept
 Apply the Critters block rule.
 

Detailed Description

Critters reversible CA block rule.

Specification (Toffoli & Margolus, 1987):

  • If the 2×2 block has exactly two alive cells, leave it unchanged.
  • Otherwise, invert each cell (alive ↔ empty) and rotate the block 180° around its centre.

Both branches are involutions and their composition is also an involution: applying the rule twice to the same block returns the original block. Combined with the Margolus 2×2 partition (which alternates origin between consecutive steps), the resulting CA is bit-exact reversible.

Definition at line 140 of file tpl_ca_block_rule.H.

Member Function Documentation

◆ operator()()

template<typename State >
constexpr Block_2x2< State > Aleph::CA::Critters_Rule::operator() ( const Block_2x2< State > &  in) const
inlineconstexprnoexcept

Apply the Critters block rule.

Template Parameters
Statecell state (binary; bool or any integral with 0 = empty / 1 = alive).
Parameters
[in]incurrent 2×2 block (NW, NE, SW, SE).
Returns
next 2×2 block.
Exceptions
Thisfunction does not throw.

Definition at line 151 of file tpl_ca_block_rule.H.

References Aleph::blossom_maximum_cardinality_matching(), and out.


The documentation for this class was generated from the following file: