From 2154840844ae6ad7c3b09be031c90be9a5b37478 Mon Sep 17 00:00:00 2001 From: DomNomNomVR <108088541+DomNomNomVR@users.noreply.github.com> Date: Wed, 16 Apr 2025 20:42:50 +1200 Subject: [PATCH] a --- skewb_solver.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/skewb_solver.py b/skewb_solver.py index 7c532b0..6bbb052 100644 --- a/skewb_solver.py +++ b/skewb_solver.py @@ -298,12 +298,13 @@ def breadth_first_search( step_count = 0 while q and max_steps > 0: - if max_steps % 1000 == 0 and step_count: - print(".", end="", flush=True) + if step_count % 1000 == 0 and step_count: + print(f".", end="", flush=True) if ( bidirectional_fallback_threshold is not None and step_count > bidirectional_fallback_threshold ): + print("bidirectional", end=" ") return bidirectional_search(start, max_steps) step_count += 1 @@ -339,6 +340,8 @@ def print_path(path: list[Axis]): def bidirectional_search( start: Skewb, max_steps: int, end: Skewb = solved_skewb ) -> list[Twist] | None: + if start == end: + return [] start.assert_valid() q = deque([start]) q2 = deque([end]) @@ -544,12 +547,13 @@ def get_paths_from_heuristic( return all(match >= m for match, m in zip(matches, mask)) print(f"{mask=} {s=}", end=" ") - if heuristic_i == len(heuristic_permutation) - 3: + if sum(mask) == len(heuristic_permutation) - 3: # print("going bidirectional now.") + print("end-bi", end=" ", flush=True) path = bidirectional_search(s, max_steps=200000) else: path = breadth_first_search( - s, step_finished, bidirectional_fallback_threshold=20000 + s, step_finished, bidirectional_fallback_threshold=200000 ) print(f" {path=}") if path is None: