14 Meta m(
"generator",
"thue_morse",
"Generates the n-th Thue Morse word.");
20 CHECK_LT(n, 64) <<
"too long!";
22 if(n == 0)
return "0";
26 for(
size_t i = 1; i < n; ++i) {
27 const size_t len = a.length();
28 for(
size_t j = 0; j <
len; ++j) {
29 a.push_back(a[j] ==
'0' ?
'1' :
'0');
33 DCHECK_LE(a.length(), 1ULL << n);
37 using Generator::Generator;
39 inline virtual std::string
generate()
override {
Contains the text compression and encoding framework.
virtual std::string generate() override
Generates a string based on the environment settings.
Generates the n-th Thue Morse word.
Env & env()
Provides access to the environment that the algorithm works in.
Base for string generators.
static std::string generate(size_t n)