73 const long value = std::strtol(text, &end, 10);
77 std::cerr <<
"Invalid rule: '" << text
78 <<
"' (expected an integer in [0, 255])\n";
86 std::size_t max_value, std::size_t &
out)
88 if (text ==
nullptr or text[0] ==
'-')
90 std::cerr <<
"Invalid " << name <<
": '"
91 << (text ==
nullptr ?
"" : text)
92 <<
"' (expected a positive integer)\n";
97 const unsigned long long value = std::strtoull(text, &end, 10);
99 value > std::numeric_limits<std::size_t>::max()
or
102 std::cerr <<
"Invalid " << name <<
": '" << text
103 <<
"' (expected an integer in [1, "
107 out =
static_cast<std::size_t
>(
value);
117 const auto ca_max = std::numeric_limits<ca_size_t>::max();
118 const auto idx_max =
static_cast<std::size_t
>(
119 std::numeric_limits<ca_index_t>::max());
122 std::cerr <<
"Invalid " << name <<
": '" << text
123 <<
"' (value is too large)\n";
135 std::array<int, 2> buf { };
139 std::span<int>(buf.data(), buf.size()));
149 s.reserve(
r.size(0));
151 s.push_back(
r.at({ i }) ?
'#' :
' ');
152 std::cout << s <<
'\n';
158 static_cast<std::uint8_t
>(
rule_no));
162 std::cout <<
"----- Rule " <<
rule_no <<
" -----\n";
164 for (std::size_t t = 1; t <=
steps; ++t)
175 std::size_t
steps = 30;
189 for (
unsigned r = 0;
r < 256; ++
r)
size_t size_t int32_t value
size_t size_t int32_t * out
Common typedefs and tag types for the Cellular Automata module.
User-supplied list of offsets for arbitrary connectivity.
Lattice that adds boundary-aware access on top of a storage.
Precomputed transition table for (self, neighbours...).
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
std::span< const T > Neighbor_View
Read-only view over a contiguous range of neighbour values.
std::ptrdiff_t ca_index_t
Signed coordinate component used by lattices and neighborhoods.
std::array< ca_index_t, N > Coord_Vec
Default coordinate vector.
void gather_neighbors(const Nbh &nh, const L &lat, const typename L::coord_type ¢er, std::span< T > out)
Populate out[0..nh.size()) with neighbour values of center.
std::size_t ca_size_t
Unsigned size component used for extents and counts.
Coord_Vec< N > Offset_Vec
Default offset vector (aliases Coord_Vec).
constexpr Lookup_Rule< 2, 2 > 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,...
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
auto max_value(const Container &data) -> std::decay_t< decltype(*std::begin(data))>
Compute maximum value.
Out-of-range neighbours behave as if the lattice ended.
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).