47#include <gtest/gtest.h>
76 static_cast<int>(((i + j) % 2 + 2) % 2));
81 std::set<std::pair<long long, long long>>
seen;
86 const auto key = std::pair<long long, long long>(
87 static_cast<long long>(
px[0] * 1
e6),
88 static_cast<long long>(
px[1] * 1
e6));
90 <<
"duplicate pixel for (i=" << i <<
", j=" << j <<
")";
127struct Spread_Once_Functor
129 template <
typename State>
130 [[
nodiscard]]
constexpr State operator()(
const State ¤t,
131 const std::size_t alive)
const noexcept
133 return (current != State{}
or alive >= 1) ?
static_cast<State
>(1)
134 :
static_cast<State
>(0);
188 lat, [](
int v) {
return v != 0 ? std::string(
"blue") : std::string(
"white"); });
189 EXPECT_NE(
out.find(
"regular polygon sides=3"), std::string::npos);
size_t size_t int32_t * out
Common typedefs and tag types for the Cellular Automata module.
Rule whose next state depends on (current, alive_count).
Synchronous double-buffered engine.
void run(const std::size_t steps)
Run several synchronous steps.
Triangular lattice with parity helpers over a 2D storage.
void set_tri(Tri_Coord c, const state_type &v)
Write cell value at triangular coords (i, j) (strict).
Three edge-neighbours over a 2D lattice with parity coupling.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
constexpr int tri_parity(const Tri_Coord &c) noexcept
std::array< double, 2 > tri_pixel_centre(const Tri_Coord &c, const double side) noexcept
Cartesian centre of a triangle in (i, j) units.
std::ptrdiff_t ca_index_t
Signed coordinate component used by lattices and neighborhoods.
constexpr bool tri_is_down(const Tri_Coord &c) noexcept
constexpr bool tri_is_up(const Tri_Coord &c) noexcept
void render_triangular_lattice_tikz(std::ostream &os, const Lattice &lat, Palette &&palette, const double side=1.0)
Render a triangular frame as a TikZ picture.
Main namespace for Aleph-w library functions.
Out-of-range neighbours behave as if the lattice ended.
Coordinates of a triangular cell as (i, j) integers.
C++20 concepts for the Cellular Automata module.
Synchronous double-buffered engine for cellular automata.
Neighborhoods catalogue for Aleph::CA.
Rule mechanisms for Aleph::CA.
Dense, contiguous storage for cellular automata cells (1D/2D/3D).
Triangular lattice with up/down parity helpers and pixel mapping suitable for visualisation.