Fix method order (constants methods first)

This commit is contained in:
Stefan Müller 2024-12-25 21:44:39 +01:00
parent 69a4b4becc
commit 06afa3ae2e
2 changed files with 16 additions and 16 deletions

View File

@ -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;
};

View File

@ -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;
}