64 template <
typename Nbh>
65 void render(
const std::string & title,
const Nbh & nh,
68 std::vector<Offset_Vec<2>> offs;
69 nh.for_each_offset(center, [&](
const auto & o) { offs.push_back(o); });
71 int min_r = 0, max_r = 0, min_c = 0, max_c = 0;
74 min_r = std::min<int>(min_r,
static_cast<int>(o[0]));
75 max_r = std::max<int>(max_r,
static_cast<int>(o[0]));
76 min_c = std::min<int>(min_c,
static_cast<int>(o[1]));
77 max_c = std::max<int>(max_c,
static_cast<int>(o[1]));
80 const int rows = max_r - min_r + 1;
81 const int cols = max_c - min_c + 1;
82 std::vector<std::string> grid(
rows, std::string(
cols,
'.'));
83 grid[-min_r][-min_c] =
'o';
85 grid[o[0] - min_r][o[1] - min_c] =
'#';
87 std::cout <<
"\n=== " << title
88 <<
" (radius=" << nh.radius()
89 <<
", size=" << nh.size() <<
") ===\n";
90 for (
const auto & line : grid)
91 std::cout <<
" " << line <<
'\n';
97 std::cout <<
"Aleph::CA — Phase 2 neighborhood catalogue\n";
98 std::cout <<
"==========================================\n";
107 render(
"Triangular_Neighborhood (even parity)",
109 render(
"Triangular_Neighborhood (odd parity)",
118 render(
"Custom_Neighborhood (chess knight)", knight);
Common typedefs and tag types for the Cellular Automata module.
User-supplied list of offsets for arbitrary connectivity.
Six-neighbour hex pattern in axial coordinates over a 2D lattice.
Moore (Chebyshev) neighborhood of radius R in N dimensions.
Three edge-neighbours over a 2D lattice with parity coupling.
Von Neumann (L1) neighborhood of radius R in N dimensions.
std::array< ca_index_t, N > Coord_Vec
Default coordinate vector.
Coord_Vec< N > Offset_Vec
Default offset vector (aliases Coord_Vec).
Main namespace for Aleph-w library functions.
Neighborhoods catalogue for Aleph::CA.