50 std::discrete_distribution<int> pick({0.40, 0.55, 0.05});
53 lat.set({static_cast<ca_index_t>(i), static_cast<ca_index_t>(j)},
61 case Forest_Cell::EMPTY:
return '.';
62 case Forest_Cell::TREE:
return 'T';
63 case Forest_Cell::BURNING:
return '#';
74 static_cast<ca_index_t>(j)}));
81 std::size_t empty = 0;
83 std::size_t burning = 0;
94 if (v ==
static_cast<int>(Forest_Cell::EMPTY)) ++t.empty;
95 else if (v ==
static_cast<int>(Forest_Cell::TREE)) ++t.tree;
107 constexpr std::uint64_t master_seed = 0xC0FFEE0042Aull;
111 std::cout <<
"Forest-fire reference example\n";
112 std::cout <<
" size=" <<
rows <<
"x" <<
cols
113 <<
" master_seed=0x" << std::hex << master_seed << std::dec
114 <<
" p_growth=0.02 p_lightning=0.001\n";
120 lat.set({
rows / 2,
cols / 2},
static_cast<int>(Forest_Cell::BURNING));
121 lat.set({1, 1},
static_cast<int>(Forest_Cell::BURNING));
128 std::cout <<
"\n=== step 0 (initial) ===\n";
131 std::cout <<
"tally: empty=" << t.empty <<
" trees=" << t.tree
132 <<
" burning=" << t.burning <<
'\n';
134 for (std::size_t step = 1; step <=
total_steps; ++step)
139 std::cout <<
"\n=== step " << step <<
" ===\n";
142 std::cout <<
"tally: empty=" << t.empty <<
" trees=" << t.tree
143 <<
" burning=" << t.burning <<
'\n';
147 std::cout <<
"\nDone after " <<
total_steps <<
" steps.\n";
Reproducible random-number support for stochastic CA rules (Phase 8).
Common typedefs and tag types for the Cellular Automata module.
Forest-fire rule (Drossel & Schwabl, 1992).
Lattice that adds boundary-aware access on top of a storage.
Moore (Chebyshev) neighborhood of radius R in N dimensions.
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().
Forest_Cell
Discrete states of the forest-fire automaton.
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.
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.
Reproducible stochastic CA rules (Phase 8).
Dense, contiguous storage for cellular automata cells (1D/2D/3D).