Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
tpl_ca_rule.H File Reference

Rule mechanisms for Aleph::CA. More...

#include <array>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <random>
#include <type_traits>
#include <tuple>
#include <utility>
#include <ah-errors.H>
#include <ca-rng.H>
#include <ca-traits.H>
Include dependency graph for tpl_ca_rule.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Aleph::CA::Outer_Totalistic_Rule< F >
 Rule whose next state depends on (current, alive_count). More...
 
class  Aleph::CA::Totalistic_Rule< F >
 Rule whose next state depends on the sum of every cell in the neighbourhood (including the centre). More...
 
class  Aleph::CA::Lookup_Rule< NumStates, NumNeighbors >
 Precomputed transition table for (self, neighbours...). More...
 
class  Aleph::CA::Probabilistic_Rule< F, Engine >
 Reproducible stochastic rule wrapper (Phase 8). More...
 
class  Aleph::CA::Composite_Rule< Rules >
 Sequential composition of one or more rules. More...
 
struct  Aleph::CA::Game_Of_Life_Functor
 Functor implementing Conway's Game of Life canonical rule (B3/S23). More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 
namespace  Aleph::CA
 
namespace  Aleph::CA::ca_rule_detail
 

Typedefs

using Aleph::CA::Game_Of_Life_Rule = Outer_Totalistic_Rule< Game_Of_Life_Functor >
 Outer-totalistic rule type implementing Conway's Game of Life.
 

Functions

constexpr std::size_t Aleph::CA::ca_rule_detail::static_pow_rule (std::size_t base, std::size_t exp) noexcept
 
constexpr Lookup_Rule< 2, 2 > Aleph::CA::make_wolfram_elementary_rule (std::uint8_t rule_no) noexcept
 Build the elementary 1D Wolfram rule rule_no (0..255) as a Lookup_Rule<2, 2> over neighbourhood {-1, +1}.
 
constexpr Game_Of_Life_Rule Aleph::CA::make_game_of_life_rule () noexcept
 Build the canonical Game of Life rule.
 

Detailed Description

Rule mechanisms for Aleph::CA.

All rules in this header are invocable with the canonical signature

next_state = rule(current_state, neighbour_view)

so they satisfy the RuleLike<R, L> concept of tpl_ca_concepts.H. Catalogue:

  • Outer_Totalistic_Rule<F> — F(state, alive_count) -> state (Game of Life and any B/S-style rule).
  • Totalistic_Rule<F> — F(sum_including_self) -> state (Wolfram totalistic codes).
  • Lookup_Rule<S, K> — precomputed table over (self, k0..) with index = self * S^K + neighbours[0] * S^(K-1) + .... The factory make_wolfram_elementary_rule(rule_no) builds the corresponding Lookup_Rule<2, 2> for the 256 elementary Wolfram rules of 1D radius-1 binary CAs.
  • Probabilistic_Rule<F, Engine> — reproducible stochastic wrapper integrated with Per_Thread_RNG (Phase 8). When F has signature (State, Neighbor_View<State>, Engine&) -> State, the rule injects a fresh deterministic engine seeded from (master_seed, step, coord) so that the result is bit-exact regardless of thread scheduling. The legacy (State, Neighbor_View<State>) -> State signature is still accepted unchanged.
  • Composite_Rule<R...> — sequential composition.
  • Game_Of_Life_Rule — convenience instance (B3/S23).
Author
Leandro Rabindranath Leon

Definition in file tpl_ca_rule.H.