From 70ac0f773fe8cbc9d6b0bb539fd45938c8fc9883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andy=20Teijelo=20P=C3=A9rez?= Date: Mon, 21 Nov 2016 13:56:18 -0500 Subject: [PATCH] Compute invariants --- main.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/main.py b/main.py index 75322d8..7e068c4 100755 --- a/main.py +++ b/main.py @@ -104,5 +104,16 @@ if __name__ == "__main__": # if matches(e, constraints): # draw(solution, width, pattern) + fixed = [] for sol in solve2(width, pattern, constraints): + exp = list(expand_solution(sol, width, pattern)) + if len(fixed) == 0: + fixed = exp + else: + for i,e in enumerate(exp): + if fixed[i] != e: + fixed[i] = -1 draw(sol, width, pattern) + + print("invariants:") + print("".join({1:'\N{LEFT SEVEN EIGHTHS BLOCK}',0:'.',-1:'?'}[x] for x in fixed))