Compute invariants

This commit is contained in:
Andy Teijelo Pérez 2016-11-21 13:56:18 -05:00
parent a4d3ac9247
commit 70ac0f773f

11
main.py
View file

@ -104,5 +104,16 @@ if __name__ == "__main__":
# if matches(e, constraints): # if matches(e, constraints):
# draw(solution, width, pattern) # draw(solution, width, pattern)
fixed = []
for sol in solve2(width, pattern, constraints): 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) draw(sol, width, pattern)
print("invariants:")
print("".join({1:'\N{LEFT SEVEN EIGHTHS BLOCK}',0:'.',-1:'?'}[x] for x in fixed))