45std::size_t population(
const Grid &frame)
47 std::size_t
count = 0;
49 for (
ca_size_t c = 0; c < frame.size(1); ++c)
50 if (frame.at({static_cast<ca_index_t>(r), static_cast<ca_index_t>(c)}) != 0)
68 const std::size_t start = population(
engine.frame());
70 const std::size_t after_one = population(
engine.frame());
72 const std::size_t after_two = population(
engine.frame());
74 std::cout <<
"Aleph-w consumer: Game of Life blinker\n"
75 <<
" population: " << start <<
" -> " << after_one
76 <<
" -> " << after_two <<
'\n';
78 const bool ok = start == 3
and after_one == 3
and after_two == 3
83 std::cerr <<
"consumer: blinker did not behave as a period-2 oscillator\n";
86 std::cout <<
" Aleph-w integration OK\n";
Lattice that adds boundary-aware access on top of a storage.
state_type at(const coord_type &c) const
Strict access: throws if c is out of range.
Moore (Chebyshev) neighborhood of radius R in N dimensions.
Synchronous double-buffered engine.
const Lattice & frame() const noexcept
Return the current frame.
constexpr Game_Of_Life_Rule make_game_of_life_rule() noexcept
Build the canonical Game of Life rule.
std::size_t ca_size_t
Unsigned size component used for extents and counts.
and
Check uniqueness with explicit hash + equality functors.
Itor::difference_type count(const Itor &beg, const Itor &end, const T &value)
Count elements equal to a value.
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).