Add solution for "Day 17: Chronospatial Computer", part 2

This commit is contained in:
2025-05-21 20:34:34 +02:00
parent 5201dcf0bc
commit 45ab5f93ec
9 changed files with 104 additions and 6 deletions

View File

@@ -37,4 +37,5 @@ class ChronospatialComputer
std::array<std::unique_ptr<ChronospatialComputerInstruction>, 8> instructions_;
std::vector<int> program_;
ChronospatialComputerState state_;
long long findQuineState();
};

View File

@@ -30,7 +30,7 @@ class ChronospatialComputerInstruction
protected:
virtual void runValue(ChronospatialComputerState& state, const int operandValue) const = 0;
private:
std::function<int(const std::array<int, 3>&, const int)> operandFunctor_;
std::function<int(const std::array<long long, 3>&, const int)> operandFunctor_;
};
#pragma region ChronospatialComputerDivisionInstruction

View File

@@ -22,6 +22,6 @@ class ChronospatialComputerState
{
public:
size_t instructionPointer{ 0 };
std::array<int, 3> registers{};
std::array<long long, 3> registers{};
std::ostringstream output{};
};