From a1bd117b5641f6bc3e55327a9b146563328af815 Mon Sep 17 00:00:00 2001 From: Eric Mertens Date: Thu, 6 Apr 2023 21:07:44 -0700 Subject: [PATCH] z3 compat --- 2022/21.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/2022/21.cpp b/2022/21.cpp index cca346e..f2b4347 100644 --- a/2022/21.cpp +++ b/2022/21.cpp @@ -163,10 +163,12 @@ auto Part2(Input const& input) -> std::int64_t solver.add(constants.at(entry.lvalue) == rhs); } } + if (solver.check() != z3::sat) { throw std::runtime_error{"no solution to part 2"}; } - return solver.get_model().eval(constants.at("humn")).as_int64(); + + return solver.get_model().eval(constants.at("humn")).get_numeral_int64(); } } // namespace