From 237dde9c36eebd92719f29f225c6ca59433c84f1 Mon Sep 17 00:00:00 2001 From: StarCells Date: Sun, 23 Aug 2026 13:43:54 +0800 Subject: [PATCH] 202608231343 --- include/r8veritas.hh | 2 +- tests/r8_test.cc | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/r8veritas.hh b/include/r8veritas.hh index 31cfdbd..1a18197 100644 --- a/include/r8veritas.hh +++ b/include/r8veritas.hh @@ -204,7 +204,7 @@ public: } } - bool is_set1 = (str[CELL_SIZE] == '1'); + bool is_set1 = ((s.bc & 1) == SET1); if (enable_debug_output) { std::cout << "SACRIFICE: " << s.sacrifice; diff --git a/tests/r8_test.cc b/tests/r8_test.cc index 924ade9..02a1845 100644 --- a/tests/r8_test.cc +++ b/tests/r8_test.cc @@ -2,7 +2,7 @@ #include #include -using problem_t = r8veritas<5>; +using problem_t = r8veritas<6>; problem_t::cell func_copy(problem_t::cell inp) { bool A = inp & 0b1; @@ -50,11 +50,20 @@ problem_t::cell func_half_add(problem_t::cell inp) { return (S << 3) | (Co << 2) | (inp & 0b11); } +problem_t::cell func_full_add(problem_t::cell inp) { + bool A = inp & 0b1; + bool B = inp & 0b10; + bool C = inp & 0b100; + bool S = A ^ B ^ C; + bool Co = (A & B) | (A & C) | (B & C); + return (Co << 4) | (S << 3) | (inp & 0b111); +} + int main() { problem_t problem; problem.initialize_nicknames(); problem.initialize_tp_paths(); - auto tab1 = problem.generate_truthtable(func_full_add_Co); + auto tab1 = problem.generate_truthtable(func_full_add); auto new_tab1 = problem.compress_stat_space(tab1); if (problem.bfs(new_tab1, true)) { auto p = problem.track_path(tab1);