149int main(
int argc,
char *argv[])
151 const fs::path out_dir = argc >= 2 ? fs::path(argv[1]) : fs::path(
"docs/gallery");
152 fs::create_directories(out_dir);
154 std::cout <<
"Rendering gallery into " << out_dir <<
"\n";
157 std::cout <<
"Life-like rules:\n";
159 render_life_like(out_dir,
"conway_b3s23",
160 [](
int s, std::size_t n) {
return (n == 3 or (s != 0
and n == 2)) ? 1 : 0; },
161 96, 80, 0.30,
RGB8{120, 220, 140});
163 render_life_like(out_dir,
"highlife_b36s23",
164 [](
int s, std::size_t n)
165 {
return ((n == 3 or n == 6) or (s != 0
and n == 2) or (s != 0
and n == 3)) ? 1 : 0; },
166 96, 80, 0.30,
RGB8{240, 180, 90});
168 render_life_like(out_dir,
"day_and_night_b3678s34678",
169 [](
int s, std::size_t n)
171 const bool birth = (n == 3 or n == 6 or n == 7 or n == 8);
172 const bool survive = (n == 3 or n == 4 or n == 6 or n == 7 or n == 8);
173 return ((s == 0
and birth) or (s != 0
and survive)) ? 1 : 0;
175 96, 64, 0.45,
RGB8{150, 180, 250});
177 render_life_like(out_dir,
"seeds_b2s",
178 [](
int s, std::size_t n) {
return (s == 0
and n == 2) ? 1 : 0; },
179 96, 24, 0.06,
RGB8{250, 120, 120});
181 render_life_like(out_dir,
"maze_b3s12345",
182 [](
int s, std::size_t n)
184 const bool survive = (n >= 1
and n <= 5);
185 return ((s == 0
and n == 3) or (s != 0
and survive)) ? 1 : 0;
187 96, 90, 0.18,
RGB8{200, 160, 250});
189 render_life_like(out_dir,
"two_by_two_b36s125",
190 [](
int s, std::size_t n)
192 const bool birth = (n == 3 or n == 6);
193 const bool survive = (n == 1 or n == 2 or n == 5);
194 return ((s == 0
and birth) or (s != 0
and survive)) ? 1 : 0;
196 96, 80, 0.30,
RGB8{120, 210, 230});
198 render_life_like(out_dir,
"replicator_b1357s1357",
199 [](
int, std::size_t n) {
return (n % 2 == 1) ? 1 : 0; },
200 96, 40, 0.004,
RGB8{240, 210, 120});
202 render_life_like(out_dir,
"life_without_death_b3s8",
203 [](
int s, std::size_t n) {
return ((s == 0
and n == 3) or s != 0) ? 1 : 0; },
204 96, 50, 0.06,
RGB8{170, 230, 160});
207 std::cout <<
"Wolfram elementary rules:\n";
208 const RGB8 ink{30, 30, 40};
209 render_wolfram(out_dir, 30, 201, 100, ink);
210 render_wolfram(out_dir, 54, 201, 100, ink);
211 render_wolfram(out_dir, 60, 201, 100, ink);
212 render_wolfram(out_dir, 90, 201, 100, ink);
213 render_wolfram(out_dir, 110, 201, 100, ink);
214 render_wolfram(out_dir, 150, 201, 100, ink);
215 render_wolfram(out_dir, 184, 201, 100, ink);
216 render_wolfram(out_dir, 250, 201, 100, ink);
218 std::cout <<
"Done.\n";