From 06afa3ae2e3c60accd26ec65c2de395d3051a29d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Wed, 25 Dec 2024 21:44:39 +0100 Subject: [PATCH] Fix method order (constants methods first) --- include/aoc/GuardGallivant.hpp | 4 ++-- src/GuardGallivant.cpp | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/aoc/GuardGallivant.hpp b/include/aoc/GuardGallivant.hpp index b1224cf..fdd8110 100644 --- a/include/aoc/GuardGallivant.hpp +++ b/include/aoc/GuardGallivant.hpp @@ -27,10 +27,10 @@ class GuardGallivant virtual void finish() override; private: Point2 start_{}; - void visitPosition(const Point2& current); - size_t turnDirection(const size_t current) const; const size_t getStartDirectionIndex() const; const char getStartChar() const; const char getVisitedChar() const; const char getObstructionChar() const; + void visitPosition(const Point2& current); + size_t turnDirection(const size_t current) const; }; diff --git a/src/GuardGallivant.cpp b/src/GuardGallivant.cpp index b14cfc8..d8bbbb9 100644 --- a/src/GuardGallivant.cpp +++ b/src/GuardGallivant.cpp @@ -56,20 +56,6 @@ void GuardGallivant::finish() } } -void GuardGallivant::visitPosition(const Point2& current) -{ - if (getPosition(current) != getVisitedChar()) - { - setPosition(current, getVisitedChar()); - part1++; - } -} - -size_t GuardGallivant::turnDirection(const size_t current) const -{ - return current == 0 ? 3 : current - 1; -} - const size_t GuardGallivant::getStartDirectionIndex() const { return 2; @@ -89,3 +75,17 @@ const char GuardGallivant::getObstructionChar() const { return '#'; } + +void GuardGallivant::visitPosition(const Point2& current) +{ + if (getPosition(current) != getVisitedChar()) + { + setPosition(current, getVisitedChar()); + part1++; + } +} + +size_t GuardGallivant::turnDirection(const size_t current) const +{ + return current == 0 ? 3 : current - 1; +}