63 const unsigned long value = std::strtoul(text, &end, 10);
64 if (end == text
or *end !=
'\0' or value == 0
65 or value > std::numeric_limits<std::size_t>::max())
67 return static_cast<std::size_t
>(
value);
73 const std::vector<std::pair<int, int>> &cells)
77 for (
const auto &[dr, dc] : cells)
88 {4,0}, {4,1}, {5,0}, {5,1},
89 {2,12}, {2,13}, {3,11}, {3,15}, {4,10}, {4,16},
90 {5,10}, {5,14}, {5,16}, {5,17}, {6,10}, {6,16},
91 {7,11}, {7,15}, {8,12}, {8,13},
92 {0,24}, {1,22}, {1,24}, {2,20}, {2,21}, {3,20},
93 {3,21}, {4,20}, {4,21}, {5,22}, {5,24}, {6,24},
94 {2,34}, {2,35}, {3,34}, {3,35}
100 constexpr std::size_t
rows = 5;
101 constexpr std::size_t
cols = 5;
105 for (std::size_t
r = 0;
r <
rows; ++
r)
106 for (std::size_t c = 0; c <
cols; ++c)
118 const std::filesystem::path
out_dir =
argc >= 2 ?
argv[1] :
"ca_gallery_output";
120 const bool live =
argc >= 4
and std::string(
argv[3]) ==
"--live";
121 std::filesystem::create_directories(
out_dir);
135 xopts.title =
"Aleph::CA gallery";
139 for (std::size_t t = 0; t <=
steps; ++t)
159 opts.omit_dead_cells =
false;
163 std::ofstream
out(
out_dir /
"life.npy", std::ios::binary);
186 std::ofstream
out(
out_dir /
"ffmpeg-command.txt");
190 std::cout <<
"Gallery written to " <<
out_dir <<
'\n';
191 std::cout <<
"Open life.html in a browser, life.gif in an image viewer, "
192 <<
"and life.vtk in ParaView.\n";
Terminal and golden-test renderers for CA frames.
size_t size_t int32_t value
size_t size_t int32_t * out
GraphViz DOT renderer for graph cellular automata.
Convenience builders for the Phase 3 synchronous engine.
Runtime ffmpeg sink for publication-quality CA video.
Animated GIF sink for cellular-automata trajectories.
Self-contained HTML trajectory player for CA frames.
NumPy .npy writer for CA frames.
Dependency-free PNG frame sink for cellular automata.
Native SVG renderer for rectangular, hexagonal and triangular CAs.
VTK legacy writer for scientific CA visualisation.
Optional live X11 viewer sink for CA simulations.
Frame sink that streams PPM frames into ffmpeg.
Sink that buffers frames and writes an animated GIF on flush.
Graph lattice: one cell per node + precomputed adjacency.
Sink that writes a self-contained HTML playback file.
Lattice that adds boundary-aware access on top of a storage.
Path-pattern sink that writes one PNG file per accepted frame.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
void write_vtk_legacy(std::ostream &out, const Lattice &frame, const VTK_Write_Options &opts={})
Write a 2D or 3D lattice as VTK legacy STRUCTURED_POINTS.
std::ptrdiff_t ca_index_t
Signed coordinate component used by lattices and neighborhoods.
Array< Array< std::size_t > > make_grid_graph_adjacency(std::size_t rows, std::size_t cols, bool periodic=false)
Build the adjacency of a 2D 4-neighbour grid graph.
void render_ascii(std::ostream &out, const Lattice &frame, Palette &&palette, const Ascii_Render_Options &opts={})
Render a rank-2 frame as text.
Game_Of_Life_Engine make_gol_engine(ca_size_t rows, ca_size_t cols)
Build a Conway's Game of Life engine of the given shape.
void render_lattice_svg(std::ostream &out, const Lattice &frame, Palette &&palette, const SVG_Render_Options &opts={}, const typename Lattice::state_type &dead_state=typename Lattice::state_type{})
Render a supported rank-2 CA frame as SVG.
void render_graph_lattice_dot(std::ostream &out, const Graph &graph, Palette &&palette, const DOT_Render_Options &opts={})
Render a graph CA frame as GraphViz DOT.
std::size_t ca_size_t
Unsigned size component used for extents and counts.
void write_npy(std::ostream &out, const Lattice &frame)
Write a lattice frame as a NumPy .npy array.
and
Check uniqueness with explicit hash + equality functors.
Options for textual CA rendering.
bool include_border
draw a simple +---+ border
Default binary text palette.
Default binary DOT fill-colour palette.
Default binary RGB mapper.
Options for Ffmpeg_Frame_Sink.
bool auto_start
start ffmpeg in the constructor
Options for animated GIF output.
Options for generated HTML players.
double cell_size
logical cell size in SVG units
The lattice wraps around on every axis.
Options for VTK legacy output.
Options for the live X11 viewer.
bool enabled
disable to force no-op behaviour
CA whose underlying topology is an arbitrary undirected graph.
Cellular automata lattice with pluggable boundary policies.
Dense, contiguous storage for cellular automata cells (1D/2D/3D).