From 42fce590a080f743fb281eb033561094f5bff19d Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Sat, 14 Jan 2023 00:04:48 +0800 Subject: [PATCH] fix: analyse filter same layer cases --- src/analyse/analyse.cc | 11 ++++-- src/main.cc | 18 +++++----- svg-demo/demo.yml | 79 ------------------------------------------ 3 files changed, 17 insertions(+), 91 deletions(-) delete mode 100644 svg-demo/demo.yml diff --git a/src/analyse/analyse.cc b/src/analyse/analyse.cc index b0361c4..269eede 100644 --- a/src/analyse/analyse.cc +++ b/src/analyse/analyse.cc @@ -249,10 +249,15 @@ void Analyse::new_case(uint64_t code, uint64_t mask) { auto current = cases.find(code); if (current != cases.end()) { // find existed case - current->second.mask |= mask; // update mask info - if (current->second.step != cache.front()->step) { - current->second.src.push_back(cache.front()); + if (current->second.step == cache.front()->step + 1) { + + current->second.mask |= mask; // update mask info + + if (current->second.step != cache.front()->step) { + current->second.src.push_back(cache.front()); + } + } return; diff --git a/src/main.cc b/src/main.cc index 2cf2b77..415b699 100644 --- a/src/main.cc +++ b/src/main.cc @@ -212,17 +212,17 @@ int main() { // }; // a.backtrack(raw_codes); -// std::vector raw_codes = { -// CommonCode("DE77D80").to_raw_code().unwrap(), -// CommonCode("DF6DD80").to_raw_code().unwrap(), -// CommonCode("DF69730").to_raw_code().unwrap(), -// CommonCode("DE76D30").to_raw_code().unwrap(), -// CommonCode("D5AF730").to_raw_code().unwrap(), -// CommonCode("D5B43BC").to_raw_code().unwrap(), -// }; std::vector raw_codes = { - CommonCode("EF697C0").to_raw_code().unwrap(), + CommonCode("DE77D80").to_raw_code().unwrap(), + CommonCode("DF6DD80").to_raw_code().unwrap(), + CommonCode("DF69730").to_raw_code().unwrap(), + CommonCode("DE76D30").to_raw_code().unwrap(), + CommonCode("D5AF730").to_raw_code().unwrap(), + CommonCode("D5B43BC").to_raw_code().unwrap(), }; +// std::vector raw_codes = { +// CommonCode("EF697C0").to_raw_code().unwrap(), +// }; // TODO: FATAL ERROR -> don't using mask in Analyse a.backtrack(raw_codes); diff --git a/svg-demo/demo.yml b/svg-demo/demo.yml deleted file mode 100644 index f4f504b..0000000 --- a/svg-demo/demo.yml +++ /dev/null @@ -1,79 +0,0 @@ -layer: -- [[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,1,2],[0,2,1,1],[1,2,2,1],[2,2,2,2],[0,3,2,1],[1,4,1,1],[2,4,1,1]]] # layer 0 -- [[[0,0,1,2],[2,0,1,2],[0,1,1,1],[2,1,1,2],[0,2,1,1],[1,2,2,1],[2,2,2,2],[0,3,2,1],[1,4,1,1],[2,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,1,2],[0,2,1,1],[1,2,2,1],[2,2,2,2],[0,3,2,1],[1,4,1,1],[3,4,1,1]]] # layer 1 -- [[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,2,1],[2,1,1,2],[0,2,1,1],[2,2,2,2],[0,3,2,1],[1,4,1,1],[2,4,1,1]],[[0,0,1,2],[2,0,1,2],[1,1,1,1],[2,1,1,2],[0,2,1,1],[1,2,2,1],[2,2,2,2],[0,3,2,1],[1,4,1,1],[2,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,1,1],[2,1,1,2],[0,2,1,1],[1,2,2,1],[2,2,2,2],[0,3,2,1],[1,4,1,1],[3,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,1,2],[0,2,1,1],[1,2,2,1],[2,2,2,2],[0,3,2,1],[2,4,1,1],[3,4,1,1]]] # layer 2 -- [[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,2,1],[2,1,1,2],[0,2,1,1],[2,2,2,2],[0,3,2,1],[1,3,1,1],[2,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,1,1],[2,1,1,2],[1,2,2,1],[2,2,2,2],[0,3,2,1],[1,4,1,1],[2,4,1,1]],[[0,0,1,2],[2,0,1,2],[1,1,1,1],[2,1,1,2],[0,2,1,1],[1,2,2,1],[2,2,2,2],[0,3,2,1],[1,4,1,1],[3,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,1,1],[2,1,1,2],[0,2,1,1],[1,2,2,1],[2,2,2,2],[0,3,2,1],[2,4,1,1],[3,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,1,2],[0,2,1,1],[2,2,2,2],[0,3,2,1],[1,3,2,1],[2,4,1,1],[3,4,1,1]]] # layer 3 -- [[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,2,1],[2,1,1,2],[0,2,1,1],[2,2,2,2],[0,3,2,1],[1,3,1,1],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,1,1],[2,1,1,2],[0,2,2,1],[1,2,2,1],[2,2,2,2],[1,4,1,1],[2,4,1,1]],[[0,0,1,2],[2,0,1,2],[1,1,1,1],[2,1,1,2],[0,2,1,1],[1,2,2,1],[2,2,2,2],[0,3,2,1],[2,4,1,1],[3,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,1,1],[2,1,1,2],[0,2,1,1],[2,2,2,2],[0,3,2,1],[1,3,2,1],[2,4,1,1],[3,4,1,1]]] # layer 4 -- [[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,2,1],[2,1,1,2],[0,2,1,1],[0,3,2,1],[1,3,1,1],[2,3,2,2],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,1,1],[2,1,1,2],[0,2,2,1],[1,2,2,1],[2,2,2,2],[0,4,1,1],[2,4,1,1]],[[0,0,1,2],[2,0,1,2],[1,1,1,1],[2,1,1,2],[0,2,1,1],[2,2,2,2],[0,3,2,1],[1,3,2,1],[2,4,1,1],[3,4,1,1]],[[0,0,1,2],[2,0,1,2],[2,1,1,2],[0,2,1,1],[1,2,1,1],[2,2,2,2],[0,3,2,1],[1,3,2,1],[2,4,1,1],[3,4,1,1]]] # layer 5 -- [[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,2,1],[0,2,1,1],[2,2,1,2],[0,3,2,1],[1,3,1,1],[2,3,2,2],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,1,1],[2,1,1,2],[0,2,2,1],[1,2,2,1],[2,2,2,2],[0,4,1,1],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[1,1,1,1],[2,1,1,2],[1,2,1,1],[2,2,2,2],[0,3,2,1],[1,3,2,1],[2,4,1,1],[3,4,1,1]]] # layer 6 -- [[[0,0,1,2],[0,1,1,1],[1,1,2,1],[2,1,1,2],[0,2,1,1],[2,2,1,2],[0,3,2,1],[1,3,1,1],[2,3,2,2],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,1,1],[2,1,1,2],[0,2,2,1],[1,2,2,1],[2,3,2,2],[0,4,1,1],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,2,1],[1,1,1,1],[2,1,1,2],[1,2,1,1],[2,2,2,2],[1,3,2,1],[2,4,1,1],[3,4,1,1]]] # layer 7 -- [[[2,0,1,2],[0,1,1,1],[1,1,2,1],[2,1,1,2],[0,2,1,1],[2,2,1,2],[0,3,2,1],[1,3,1,1],[2,3,2,2],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,1,1],[1,1,1,1],[0,2,2,1],[1,2,2,1],[2,2,1,2],[2,3,2,2],[0,4,1,1],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,2,1],[1,1,1,1],[2,1,1,2],[1,2,1,1],[2,2,2,2],[0,3,2,1],[2,4,1,1],[3,4,1,1]]] # layer 8 -- [[[0,0,1,1],[2,0,1,2],[1,1,2,1],[2,1,1,2],[0,2,1,1],[2,2,1,2],[0,3,2,1],[1,3,1,1],[2,3,2,2],[1,4,1,1]],[[1,0,2,1],[2,0,1,2],[0,1,1,1],[2,1,1,2],[0,2,1,1],[2,2,1,2],[0,3,2,1],[1,3,1,1],[2,3,2,2],[1,4,1,1]],[[1,0,1,1],[2,0,1,2],[1,1,2,1],[2,1,1,2],[0,2,1,1],[2,2,1,2],[0,3,2,1],[1,3,1,1],[2,3,2,2],[1,4,1,1]],[[0,0,1,2],[0,1,1,1],[1,1,1,1],[2,1,1,2],[0,2,2,1],[1,2,2,1],[2,2,1,2],[2,3,2,2],[0,4,1,1],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,1,1],[3,1,1,1],[0,2,2,1],[1,2,2,1],[2,2,1,2],[2,3,2,2],[0,4,1,1],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,2,1],[1,1,1,1],[2,1,1,2],[2,2,2,2],[0,3,2,1],[1,4,1,1],[2,4,1,1],[3,4,1,1]]] # layer 9 -- [[[0,0,1,1],[1,0,2,1],[2,0,1,2],[2,1,1,2],[0,2,1,1],[2,2,1,2],[0,3,2,1],[1,3,1,1],[2,3,2,2],[1,4,1,1]],[[0,0,1,1],[2,0,1,2],[0,1,1,1],[1,1,2,1],[2,1,1,2],[2,2,1,2],[0,3,2,1],[1,3,1,1],[2,3,2,2],[1,4,1,1]],[[0,0,1,1],[1,0,1,1],[2,0,1,2],[1,1,2,1],[2,1,1,2],[2,2,1,2],[0,3,2,1],[1,3,1,1],[2,3,2,2],[1,4,1,1]],[[2,0,1,2],[0,1,1,1],[1,1,1,1],[2,1,1,2],[0,2,2,1],[1,2,2,1],[2,2,1,2],[2,3,2,2],[0,4,1,1],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[2,1,1,1],[3,1,1,1],[0,2,2,1],[1,2,2,1],[2,2,1,2],[2,3,2,2],[0,4,1,1],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,2,1],[1,1,1,1],[2,1,1,2],[1,2,2,2],[0,3,2,1],[1,4,1,1],[2,4,1,1],[3,4,1,1]]] # layer 10 -- [[[0,0,1,1],[1,0,2,1],[2,0,1,2],[0,1,1,1],[2,1,1,2],[2,2,1,2],[0,3,2,1],[1,3,1,1],[2,3,2,2],[1,4,1,1]],[[0,0,1,1],[1,0,1,1],[2,0,1,2],[0,1,2,1],[2,1,1,2],[2,2,1,2],[0,3,2,1],[1,3,1,1],[2,3,2,2],[1,4,1,1]],[[0,0,1,1],[1,0,1,1],[2,0,1,2],[0,1,2,1],[1,1,2,1],[2,1,1,2],[2,2,1,2],[1,3,1,1],[2,3,2,2],[1,4,1,1]],[[0,0,1,1],[2,0,1,2],[0,1,1,1],[2,1,1,2],[0,2,2,1],[1,2,2,1],[2,2,1,2],[2,3,2,2],[0,4,1,1],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,2,1],[2,1,1,1],[3,1,1,1],[1,2,2,1],[2,2,1,2],[2,3,2,2],[0,4,1,1],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[1,1,2,1],[2,1,1,1],[3,1,1,1],[0,2,2,1],[2,2,1,2],[2,3,2,2],[0,4,1,1],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,2,1],[1,1,1,1],[2,1,1,2],[1,2,2,2],[3,2,1,1],[0,3,2,1],[1,4,1,1],[2,4,1,1]]] # layer 11 -- [[[0,0,1,1],[1,0,2,1],[2,0,1,2],[0,1,1,1],[2,1,1,2],[0,2,1,1],[2,2,1,2],[0,3,2,1],[2,3,2,2],[1,4,1,1]],[[0,0,1,1],[1,0,1,1],[2,0,1,2],[0,1,2,1],[1,1,1,1],[2,1,1,2],[2,2,1,2],[0,3,2,1],[2,3,2,2],[1,4,1,1]],[[0,0,1,1],[1,0,1,1],[2,0,1,2],[0,1,2,1],[1,1,2,1],[2,1,1,2],[2,2,1,2],[0,3,1,1],[2,3,2,2],[1,4,1,1]],[[0,0,1,1],[1,0,1,1],[2,0,1,2],[0,1,2,1],[1,1,2,1],[2,1,1,2],[2,2,1,2],[2,3,2,2],[0,4,1,1],[1,4,1,1]],[[0,0,1,1],[1,0,2,1],[2,0,1,2],[0,1,1,1],[2,1,1,2],[0,2,2,1],[2,2,1,2],[2,3,2,2],[0,4,1,1],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,2,1],[1,1,2,1],[2,1,1,1],[3,1,1,1],[2,2,1,2],[2,3,2,2],[0,4,1,1],[1,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,2,1],[1,1,1,1],[2,1,1,2],[1,2,2,2],[3,2,1,1],[0,3,2,1],[3,3,1,1],[1,4,1,1]]] # layer 12 -- [[[0,0,1,1],[1,0,2,1],[2,0,1,2],[0,1,1,1],[2,1,1,2],[0,2,1,1],[1,2,1,1],[2,2,1,2],[0,3,2,1],[2,3,2,2]],[[0,0,1,1],[1,0,1,1],[2,0,1,2],[0,1,2,1],[1,1,1,1],[2,1,1,2],[1,2,1,1],[2,2,1,2],[0,3,2,1],[2,3,2,2]],[[0,0,1,1],[1,0,1,1],[2,0,1,2],[0,1,2,1],[1,1,2,1],[2,1,1,2],[2,2,1,2],[0,3,1,1],[2,3,2,2],[0,4,1,1]],[[0,0,1,1],[1,0,2,1],[2,0,1,2],[0,1,1,1],[2,1,1,2],[0,2,2,1],[1,2,1,1],[2,2,1,2],[2,3,2,2],[0,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,2,1],[1,1,2,1],[2,1,1,1],[3,1,1,1],[2,2,1,2],[0,3,1,1],[2,3,2,2],[0,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,2,1],[1,1,1,1],[2,1,1,2],[1,2,2,2],[3,2,1,1],[0,3,2,1],[3,3,1,1],[3,4,1,1]]] # layer 13 -- [[[0,0,1,1],[1,0,2,1],[2,0,1,2],[0,1,1,1],[2,1,1,2],[0,2,1,1],[1,2,1,1],[2,2,1,2],[0,3,2,1],[1,3,2,2]],[[0,0,1,1],[1,0,1,1],[2,0,1,2],[0,1,2,1],[1,1,1,1],[2,1,1,2],[1,2,1,1],[2,2,1,2],[0,3,2,1],[1,3,2,2]],[[0,0,1,1],[1,0,1,1],[2,0,1,2],[0,1,2,1],[1,1,2,1],[2,1,1,2],[2,2,1,2],[0,3,1,1],[1,3,2,2],[0,4,1,1]],[[0,0,1,1],[1,0,2,1],[2,0,1,2],[0,1,1,1],[2,1,1,2],[0,2,2,1],[1,2,1,1],[2,2,1,2],[1,3,2,2],[0,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,2,1],[1,1,2,1],[2,1,1,1],[3,1,1,1],[2,2,1,2],[0,3,1,1],[1,3,2,2],[0,4,1,1]],[[0,0,1,2],[2,0,1,2],[0,1,2,1],[1,1,1,1],[2,1,1,2],[3,2,1,1],[0,3,2,1],[1,3,2,2],[3,3,1,1],[3,4,1,1]]] # layer 14 - -next: -- - [0,1] # (0, 0) -> 1 -- - [0,1,2] # (1, 0) -> 2 - - [2,3] # (1, 1) -> 2 -- - [0] # (2, 0) -> 3 - - [1,2] # (2, 1) -> 3 - - [2,3] # (2, 2) -> 3 - - [3,4] # (2, 3) -> 3 -- - [0] # (3, 0) -> 4 - - [1] # (3, 1) -> 4 - - [2] # (3, 2) -> 4 - - [2,3] # (3, 3) -> 4 - - [3] # (3, 4) -> 4 -- - [0] # (4, 0) -> 5 - - [1] # (4, 1) -> 5 - - [2] # (4, 2) -> 5 - - [2,3] # (4, 3) -> 5 -- - [0] # (5, 0) -> 6 - - [1] # (5, 1) -> 6 - - [2] # (5, 2) -> 6 - - [2] # (5, 3) -> 6 -- - [0] # (6, 0) -> 7 - - [1] # (6, 1) -> 7 - - [2] # (6, 2) -> 7 -- - [0] # (7, 0) -> 8 - - [1] # (7, 1) -> 8 - - [2] # (7, 2) -> 8 -- - [0,1,2] # (8, 0) -> 9 - - [3,4] # (8, 1) -> 9 - - [5] # (8, 2) -> 9 -- - [0,1] # (9, 0) -> 10 - - [0] # (9, 1) -> 10 - - [2] # (9, 2) -> 10 - - [3] # (9, 3) -> 10 - - [4] # (9, 4) -> 10 - - [5] # (9, 5) -> 10 -- - [0] # (10, 0) -> 11 - - [0] # (10, 1) -> 11 - - [1,2] # (10, 2) -> 11 - - [3] # (10, 3) -> 11 - - [4,5] # (10, 4) -> 11 - - [6] # (10, 5) -> 11 -- - [0] # (11, 0) -> 12 - - [1] # (11, 1) -> 12 - - [2,3] # (11, 2) -> 12 - - [4] # (11, 3) -> 12 - - [5] # (11, 4) -> 12 - - [5] # (11, 5) -> 12 - - [6] # (11, 6) -> 12 -- - [0] # (12, 0) -> 13 - - [1] # (12, 1) -> 13 - - [2] # (12, 2) -> 13 - - [2] # (12, 3) -> 13 - - [3] # (12, 4) -> 13 - - [4] # (12, 5) -> 13 - - [5] # (12, 6) -> 13 -- - [0] # (13, 0) -> 14 - - [1] # (13, 1) -> 14 - - [2] # (13, 2) -> 14 - - [3] # (13, 3) -> 14 - - [4] # (13, 4) -> 14 - - [5] # (13, 5) -> 14