55#include <gtest/gtest.h>
102 lat.set({static_cast<ca_index_t>(i), static_cast<ca_index_t>(j)},
125struct Counting_Observer
127 std::size_t begins = 0;
128 std::size_t ends = 0;
130 template <
typename Frame>
131 void on_step_begin(std::size_t,
const Frame &)
136 template <
typename Frame>
137 void on_step_end(std::size_t,
const Frame &)
151 comp.on_step_begin(0, frame);
152 comp.on_step_end(1, frame);
153 comp.on_step_begin(1, frame);
167 comp.on_step_begin(0, frame);
168 comp.on_step_end(1, frame);
169 comp.on_step_begin(1, frame);
190 for (
auto a :
act.activity())
196 L seed = make_block();
203 for (
auto a :
act.activity())
222 for (std::size_t i = 0; i <
dens.size(); ++i)
240 for (std::size_t i =
dens.size() - 200; i <
dens.size(); ++i)
245 const double avg =
sum /
static_cast<double>(cnt);
271 L seed = make_block();
286 seed.set({0, 1}, 1);
seed.set({1, 2}, 1);
287 seed.set({2, 0}, 1);
seed.set({2, 1}, 1);
seed.set({2, 2}, 1);
339 for (
double e :
ent.entropy())
Convenience builders for the Phase 3 synchronous engine.
Free metric helpers for cellular automata frames.
Phase-7 observability layer for cellular automata engines.
Common typedefs and tag types for the Cellular Automata module.
Simple dynamic array with automatic resizing and functional operations.
Records the number of cells that changed across each step.
Variadic adaptor that fan-outs notifications to many observers.
Records the count of cells in tracked_state per step.
Records the Shannon entropy of the state distribution.
Lattice that adds boundary-aware access on top of a storage.
Moore (Chebyshev) neighborhood of radius R in N dimensions.
Snapshots the lattice every period steps.
Detects fixed points and short cycles via frame hashing.
Synchronous double-buffered engine.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
void attach_observer(Engine &engine, Observer &observer)
Plug an observer into an engine's pre/post-step hooks.
constexpr Game_Of_Life_Rule make_game_of_life_rule() noexcept
Build the canonical Game of Life rule.
double density(const Lattice &lat, const typename Lattice::state_type &s)
auto make_composite_observer(Observers &&...observers)
Build a Composite_Observer with deduced ownership semantics.
std::size_t ca_size_t
Unsigned size component used for extents and counts.
Main namespace for Aleph-w library functions.
T sum(const Container &container, const T &init=T{})
Compute sum of all elements.
The lattice wraps around on every axis.
Synchronous double-buffered engine for cellular automata.
Cellular automata lattice with pluggable boundary policies.
Neighborhoods catalogue for Aleph::CA.
Rule mechanisms for Aleph::CA.
Dense, contiguous storage for cellular automata cells (1D/2D/3D).