59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
// 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 <http://www.gnu.org/licenses/>.
|
|
|
|
#include <aoc/LinenLayout.hpp>
|
|
|
|
#include <sstream>
|
|
|
|
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_)
|
|
{
|
|
if (patterns_.isPossible(line))
|
|
{
|
|
part1++;
|
|
}
|
|
}
|
|
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()
|
|
{
|
|
}
|