aboutsummaryrefslogtreecommitdiff
path: root/src/2017/day21/aoc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/2017/day21/aoc.h')
-rw-r--r--src/2017/day21/aoc.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/2017/day21/aoc.h b/src/2017/day21/aoc.h
index c2bae44..1f743c2 100644
--- a/src/2017/day21/aoc.h
+++ b/src/2017/day21/aoc.h
@@ -56,6 +56,17 @@ struct square2 {
return {s0, s1, s2};
}
+ std::vector<square2> combo() const noexcept {
+ std::vector<square2> c{*this};
+ for (auto&& s : rotate()) {
+ c.emplace_back(s);
+ }
+ for (auto&& s : flip()) {
+ c.emplace_back(s);
+ }
+ return c;
+ }
+
std::string to_string() {
char sx[6] = {0};
sprintf(sx, "%c%c/%c%c", s[0], s[1], s[2], s[3]);
@@ -200,6 +211,17 @@ struct square3 {
return {s0, s1, s2, s3, s4, s5, s6};
}
+ std::vector<square3> combo() const noexcept {
+ std::vector<square3> c{*this};
+ for (auto&& s : rotate()) {
+ c.emplace_back(s);
+ }
+ for (auto&& s : flip()) {
+ c.emplace_back(s);
+ }
+ return c;
+ }
+
std::string to_string() {
char sx[12] = {0};
sprintf(sx, "%c%c%c/%c%c%c/%c%c%c", s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8]);