diff --git a/include/aoc/MonkeyMarket.hpp b/include/aoc/MonkeyMarket.hpp
new file mode 100644
index 0000000..417073e
--- /dev/null
+++ b/include/aoc/MonkeyMarket.hpp
@@ -0,0 +1,31 @@
+// 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 .
+
+#pragma once
+
+#include
+
+class MonkeyMarket
+ : public Solver
+{
+public:
+ virtual const std::string getPuzzleName() const override;
+ virtual const int getPuzzleDay() const override;
+ virtual void processDataLine(const std::string& line) override;
+ virtual void finish() override;
+private:
+ static constexpr int getNSecretNumbers();
+ static constexpr uint64_t getPruneValue();
+};
diff --git a/src/MonkeyMarket.cpp b/src/MonkeyMarket.cpp
new file mode 100644
index 0000000..2599b61
--- /dev/null
+++ b/src/MonkeyMarket.cpp
@@ -0,0 +1,52 @@
+// 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
+
+const std::string MonkeyMarket::getPuzzleName() const
+{
+ return "Monkey Market";
+}
+
+const int MonkeyMarket::getPuzzleDay() const
+{
+ return 22;
+}
+
+void MonkeyMarket::processDataLine(const std::string& line)
+{
+ uint64_t n{ std::stoull(line) };
+ for (int i = 0; i < getNSecretNumbers(); i++)
+ {
+ n = ((n << 6) ^ n) & getPruneValue();
+ n = (n >> 5) ^ n;
+ n = ((n << 11) ^ n) & getPruneValue();
+ }
+ part1 += n;
+}
+
+void MonkeyMarket::finish()
+{
+}
+
+constexpr int MonkeyMarket::getNSecretNumbers()
+{
+ return 2000;
+}
+
+constexpr uint64_t MonkeyMarket::getPruneValue()
+{
+ return 16777215;
+}
diff --git a/src/Program.cpp b/src/Program.cpp
index b486f6a..01246cb 100644
--- a/src/Program.cpp
+++ b/src/Program.cpp
@@ -42,6 +42,7 @@
#include
#include
#include
+#include
#include
void Program::run()
@@ -81,6 +82,7 @@ void Program::runSolvers()
runSolver(solverEngine);
runSolver(solverEngine);
runSolver(solverEngine);
+ runSolver(solverEngine);
runSolver(solverEngine);
}
diff --git a/tests/src/TestCases.cpp b/tests/src/TestCases.cpp
index 07754fa..56fc71b 100644
--- a/tests/src/TestCases.cpp
+++ b/tests/src/TestCases.cpp
@@ -39,6 +39,7 @@
#include
#include
#include
+#include
#include
#define REQUIRE_MESSAGE(cond, msg) if (!(cond)) { INFO(msg); REQUIRE(cond); }
@@ -383,6 +384,19 @@ TEST_CASE("[KeypadConundrumTests]")
}
}
+TEST_CASE("[MonkeyMarketTests]")
+{
+ TestContext test;
+ SECTION("FullData")
+ {
+ test.runFull(std::make_unique(), 19854248602, 0);
+ }
+ SECTION("ExampleData")
+ {
+ test.runExample(std::make_unique(), 37327623, 0);
+ }
+}
+
TEST_CASE("[LanPartyTests]")
{
TestContext test;