diff --git a/include/aoc/CeresSearch.hpp b/include/aoc/CeresSearch.hpp index 484c706..ab76933 100644 --- a/include/aoc/CeresSearch.hpp +++ b/include/aoc/CeresSearch.hpp @@ -27,7 +27,7 @@ class CeresSearch std::string getInputFileName() const override; void finish() override; private: - char xmas[4] = { 'X', 'M', 'A', 'S' }; + char xmas_[4] = { 'X', 'M', 'A', 'S' }; void computeXmasCount(const Point2& start); void computeX_MasCount(const Point2& start); }; diff --git a/include/aoc/GuardGallivant.hpp b/include/aoc/GuardGallivant.hpp index 5f287d2..8d1dca0 100644 --- a/include/aoc/GuardGallivant.hpp +++ b/include/aoc/GuardGallivant.hpp @@ -21,11 +21,12 @@ class GuardGallivant : public LinesSolver { public: - Point2 start_{}; std::string getPuzzleName() const override; std::string getInputFileName() const override; void processDataLine(const std::string& line) override; void finish() override; +private: + Point2 start_{}; void visitPosition(const Point2& current); size_t turnDirection(const size_t current) const; size_t getStartDirectionIndex() const; diff --git a/include/aoc/HistorianHysteria.hpp b/include/aoc/HistorianHysteria.hpp index 37f6c11..ecaef7d 100644 --- a/include/aoc/HistorianHysteria.hpp +++ b/include/aoc/HistorianHysteria.hpp @@ -28,6 +28,6 @@ class HistorianHysteria virtual void processDataLine(const std::string& line) override; virtual void finish() override; private: - std::multiset left; - std::multiset right; + std::multiset left_; + std::multiset right_; }; diff --git a/include/aoc/SolverEngine.hpp b/include/aoc/SolverEngine.hpp index b5c404e..783add0 100644 --- a/include/aoc/SolverEngine.hpp +++ b/include/aoc/SolverEngine.hpp @@ -27,7 +27,6 @@ class SolverEngine public: SolverEngine(const std::vector& inputPaths); void run(Solver& solver); - private: std::vector inputPaths_; std::filesystem::path tryGetValidFullInputFilePath(const std::string& inputFileName); diff --git a/src/CeresSearch.cpp b/src/CeresSearch.cpp index b851eb6..7ec8d24 100644 --- a/src/CeresSearch.cpp +++ b/src/CeresSearch.cpp @@ -31,12 +31,12 @@ void CeresSearch::finish() { for (int i = 0; i < lines[j].size(); i++) { - if (lines[j][i] == xmas[0]) + if (lines[j][i] == xmas_[0]) { Point2 start{ i, j }; computeXmasCount(start); } - else if (lines[j][i] == xmas[2]) + else if (lines[j][i] == xmas_[2]) { Point2 start{ i, j }; computeX_MasCount(start); @@ -51,7 +51,7 @@ void CeresSearch::computeXmasCount(const Point2& start) { auto p{ start + d }; auto i{ 1 }; - while (i < 4 && isInBounds(p) && xmas[i] == getPosition(p)) + while (i < 4 && isInBounds(p) && xmas_[i] == getPosition(p)) { p += d; i++; @@ -70,10 +70,10 @@ void CeresSearch::computeX_MasCount(const Point2& start) auto pUR{ start + Point2::upRight }; auto pDL{ start + Point2::downLeft }; if (isInBounds(pUL) && isInBounds(pDR) - && ((getPosition(pUL) == xmas[1] && getPosition(pDR) == xmas[3]) - || (getPosition(pUL) == xmas[3] && getPosition(pDR) == xmas[1])) - && ((getPosition(pUR) == xmas[1] && getPosition(pDL) == xmas[3]) - || (getPosition(pUR) == xmas[3] && getPosition(pDL) == xmas[1]))) + && ((getPosition(pUL) == xmas_[1] && getPosition(pDR) == xmas_[3]) + || (getPosition(pUL) == xmas_[3] && getPosition(pDR) == xmas_[1])) + && ((getPosition(pUR) == xmas_[1] && getPosition(pDL) == xmas_[3]) + || (getPosition(pUR) == xmas_[3] && getPosition(pDL) == xmas_[1]))) { part2++; } diff --git a/src/HistorianHysteria.cpp b/src/HistorianHysteria.cpp index f21bbf4..411cd4a 100644 --- a/src/HistorianHysteria.cpp +++ b/src/HistorianHysteria.cpp @@ -30,19 +30,19 @@ std::string HistorianHysteria::getInputFileName() const void HistorianHysteria::processDataLine(const std::string& line) { auto pos{ line.find(" ") }; - left.insert(std::stoi(line.substr(0, pos))); - right.insert(std::stoi(line.substr(pos + 3))); + left_.insert(std::stoi(line.substr(0, pos))); + right_.insert(std::stoi(line.substr(pos + 3))); } void HistorianHysteria::finish() { int prev{ 0 }; auto nSame{ 0 }; - auto leftIterator{ left.begin() }; - auto rightIterator{ right.begin() }; - auto rightSameIterator{ right.begin() }; + auto leftIterator{ left_.begin() }; + auto rightIterator{ right_.begin() }; + auto rightSameIterator{ right_.begin() }; - while (leftIterator != left.end()) + while (leftIterator != left_.end()) { part1 += abs(*leftIterator - *rightIterator); @@ -50,12 +50,12 @@ void HistorianHysteria::finish() { nSame = 0; // Skips over numbers in the right list that are smaller than the current left number. - while (rightSameIterator != right.end() && *rightSameIterator < *leftIterator) + while (rightSameIterator != right_.end() && *rightSameIterator < *leftIterator) { rightSameIterator++; } // Counts the occurrences of the current left number in the right list. - while (rightSameIterator != right.end() && *rightSameIterator == *leftIterator) + while (rightSameIterator != right_.end() && *rightSameIterator == *leftIterator) { rightSameIterator++; nSame++;