57void load_rle(
const std::string &label,
const std::string &text)
61 std::cout <<
" " << label <<
": ";
63 std::cout <<
"ok — " << result->width <<
"x" << result->height <<
" grid, "
64 << result->alive.size() <<
" live cell(s)\n";
66 std::cout <<
"rejected — " << result.error() <<
'\n';
73 std::cout <<
"Parsing RLE patterns with try_read_rle_string (no exceptions):\n";
75 load_rle(
"glider",
"x = 3, y = 3, rule = B3/S23\nbob$2bo$3o!\n");
76 load_rle(
"blinker",
"x = 3, y = 1, rule = B3/S23\n3o!\n");
77 load_rle(
"garbage",
"this is not a pattern @@@");
78 load_rle(
"truncated",
"x = 5, y = 5, rule = B3/S23\n");
81 std::cout <<
"\nFalling back across formats with or_else:\n";
82 const std::string
maybe_life =
"#Life 1.06\n0 0\n1 0\n2 0\n";
98 std::cout <<
" parsed " << *cells <<
" live cell(s) after fallback\n";
100 std::cout <<
" every format failed: " << cells.error() <<
'\n';
File-format readers and writers for cellular-automata frames.
constexpr size_t size() const noexcept
Return the number of elements stored in the stack.
Minimal std::expected-style result type for C++20.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
expected< Binary_Cell_Pattern, std::string > try_read_life_106(std::istream &in)
Non-throwing variant of read_life_106.
expected< RLE_Pattern, std::string > try_read_rle_string(const std::string &s)
Non-throwing variant of read_rle_string.
expected< RLE_Pattern, std::string > try_read_rle(std::istream &in)
Non-throwing variant of read_rle.
Main namespace for Aleph-w library functions.
Binary pattern shared by RLE, plaintext and Life formats.
Array< Coord_Vec< 2 > > alive
live cells as {row, col}