Compute invariants

master
Andy Teijelo Pérez 2016-11-21 13:56:18 -05:00
parent a4d3ac9247
commit 70ac0f773f
1 changed files with 11 additions and 0 deletions

11
main.py
View File

@ -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))