From: Skullheadx <94652084+Skullheadx@users.noreply.github.com> Date: Thu, 10 Nov 2022 17:34:59 +0000 (-0500) Subject: Update S4.py X-Git-Url: http://git.skullheadx.com/nixos/banner.webp?a=commitdiff_plain;h=625655287e61e46d75df4b446aaebfea57bceab9;p=CCC.git Update S4.py --- diff --git a/Main/Python/2010/S4.py b/Main/Python/2010/S4.py index 20bc12a..6818f1a 100644 --- a/Main/Python/2010/S4.py +++ b/Main/Python/2010/S4.py @@ -39,8 +39,16 @@ def deep_copy(dictionary): return out q = Queue() -for i in fences: - q.put(([i], tree)) +# for i in fences: +# q.put(([i], tree)) +tree[2].remove(3) +tree[3].remove(2) +tree[4].remove(5) +tree[5].remove(4) +tree[4].remove(7) +tree[7].remove(4) + +q.put(([(2,3),(4,5),(4,7)], tree)) @@ -65,21 +73,22 @@ while not q.empty(): c,seen = q2.get() if c == i: loops += 1 - if loops > 1: - is_solution = False - break + # if loops > 1: + # is_solution = False + # break if c in seen: continue else: seen.add(c) global_seen.add(c) - + print(c, seen) for j in pen[c]: q2.put((j,seen.copy())) # print(c,j,seen, loops) - + print(loops) + quit() if loops == 0: broken_out = True @@ -96,14 +105,7 @@ while not q.empty(): for i in current: output += fences[i] print(output, current, node_loops) - quit() - - - - - - - + quit() # find next for fence in fences: