63 constexpr std::size_t TOTAL_STEPS = 48;
64 constexpr std::size_t PRINT_EVERY = 4;
71 void stamp_glider(GhostL &lat)
84 void render_frame(
const GhostL &lat, std::size_t step)
86 std::cout <<
"\nStep " << step <<
'\n';
88 for (
ca_size_t j = 0; j < lat.size(1); ++j)
91 for (
ca_index_t i = 0; i < static_cast<ca_index_t>(lat.size(0)); ++i)
94 for (
ca_index_t j = 0; j < static_cast<ca_index_t>(lat.size(1)); ++j)
95 std::cout << (lat.at({ i, j }) ?
'#' :
' ');
99 for (
ca_size_t j = 0; j < lat.size(1); ++j)
108 "Game of Life on a 12x12 Ghost_Lattice (PeriodicBoundary, halo=1).\n"
109 "A glider is stamped near the top-left corner. It walks diagonally\n"
110 "at one cell every four generations and wraps cleanly across the\n"
111 "torus because the engine refreshes the halo before each step.\n";
113 GhostL lat({
N,
N }, 0);
117 render_frame(
engine.frame(), 0);
118 for (std::size_t s = 1; s <= TOTAL_STEPS; ++s)
121 if (s % PRINT_EVERY == 0)
122 render_frame(
engine.frame(), s);
Common typedefs and tag types for the Cellular Automata module.
Row-major dense storage for N-dimensional cellular automata.
Lattice with Halo ghost layers around the user-visible cells.
Moore (Chebyshev) neighborhood of radius R in N dimensions.
Synchronous double-buffered engine.
Number Theoretic Transform over Z / MOD Z.
constexpr Game_Of_Life_Rule make_game_of_life_rule() noexcept
Build the canonical Game of Life rule.
std::ptrdiff_t ca_index_t
Signed coordinate component used by lattices and neighborhoods.
std::size_t ca_size_t
Unsigned size component used for extents and counts.
Main namespace for Aleph-w library functions.
Synchronous double-buffered engine for cellular automata.
Ghost-layer lattice for high-performance boundary handling.
Neighborhoods catalogue for Aleph::CA.
Rule mechanisms for Aleph::CA.
Dense, contiguous storage for cellular automata cells (1D/2D/3D).