52#include <gtest/gtest.h>
123 std::set<std::pair<long long, long long>>
seen;
128 const auto key = std::pair<long long, long long>(
129 static_cast<long long>(
px[0] * 1
e6),
130 static_cast<long long>(
px[1] * 1
e6));
132 <<
"duplicate pixel for (q=" << q <<
", r=" <<
r <<
")";
174struct Bays_B2_S34_Functor
176 template <
typename State>
177 [[
nodiscard]]
constexpr State operator()(
const State ¤t,
178 const std::size_t alive)
const noexcept
180 const bool alive_now = current != State{};
243 lat, [](
int v) {
return v != 0 ? std::string(
"black") : std::string(
"white"); });
244 EXPECT_NE(
out.find(
"\\begin{tikzpicture}"), std::string::npos);
245 EXPECT_NE(
out.find(
"\\end{tikzpicture}"), std::string::npos);
246 EXPECT_NE(
out.find(
"regular polygon sides=6"), std::string::npos);
size_t size_t int32_t * out
Common typedefs and tag types for the Cellular Automata module.
Hexagonal lattice with axial accessors over a 2D storage.
void set_axial(Hex_Axial a, const state_type &v)
Write cell value at axial coords (q, r) (strict).
void set_offset_even_r(Hex_Offset o, const state_type &v)
Convenience: write using the even-r offset convention.
Six-neighbour hex pattern in axial coordinates over a 2D lattice.
static constexpr std::array< Offset_Vec< 2 >, 6 > offsets
The six axial-coordinate offsets of the hex neighborhood.
Rule whose next state depends on (current, alive_count).
Synchronous double-buffered engine.
void run(const std::size_t steps)
Run several synchronous steps.
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 Hex_Offset axial_to_offset_even_r(Hex_Axial a) noexcept
Axial -> offset (even-r convention: even rows are shifted right).
constexpr Hex_Axial cube_to_axial(Hex_Cube c) noexcept
Cube -> axial.
std::ptrdiff_t ca_index_t
Signed coordinate component used by lattices and neighborhoods.
std::array< double, 2 > axial_to_pixel_pointy(Hex_Axial a, double radius) noexcept
Pointy-top pixel coordinates of an axial cell.
void render_hex_lattice_tikz(std::ostream &os, const Lattice &lat, Palette &&palette, double radius=0.5, bool pointy_top=true)
Render a hex frame as a stand-alone TikZ picture.
constexpr Hex_Offset axial_to_offset_odd_r(Hex_Axial a) noexcept
Axial -> offset (odd-r convention: odd rows are shifted right).
constexpr Hex_Axial offset_to_axial_even_r(Hex_Offset o) noexcept
Offset (even-r) -> axial.
constexpr ca_size_t hex_distance(Hex_Axial a, Hex_Axial b) noexcept
Hex distance between two axial coordinates.
constexpr Hex_Cube axial_to_cube(Hex_Axial a) noexcept
Axial -> cube.
constexpr Hex_Axial offset_to_axial_odd_r(Hex_Offset o) noexcept
Offset (odd-r) -> axial.
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
Axial integer coordinates (q, r) of a hex cell.
Offset coordinates (col, row) for visualisation.
Out-of-range neighbours behave as if the lattice ended.
The lattice wraps around on every axis.
C++20 concepts for the Cellular Automata module.
Synchronous double-buffered engine for cellular automata.
Hexagonal lattice with axial / offset / cube coordinate conversions and a TikZ-compatible pixel mappi...
Neighborhoods catalogue for Aleph::CA.
Rule mechanisms for Aleph::CA.
Dense, contiguous storage for cellular automata cells (1D/2D/3D).