// Solutions to the Advent Of Code 2024. // Copyright (C) 2025 Stefan Müller // // This program is free software: you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free Software // Foundation, either version 3 of the License, or (at your option) any later // version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along with // this program. If not, see . #include #include const std::string LinenLayout::getPuzzleName() const { return "Linen Layout"; } const int LinenLayout::getPuzzleDay() const { return 19; } void LinenLayout::processDataLine(const std::string& line) { if (isReadingDesigns_) { auto nArrangements = patterns_.countArrangements(line); if (nArrangements > 0) { part1++; } part2 += nArrangements; } else if (line.empty()) { isReadingDesigns_ = true; } else { std::istringstream stream{ line }; std::string pattern; while (std::getline(stream, pattern, ',')) { patterns_.add(pattern); // Removes the space between comma and next pattern. char c = stream.get(); } } } void LinenLayout::finish() { }