Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
13-liner: check every single words permutations solution in Clear category for Cipher Crossword by Stensen
from itertools import permutations
def match(words, values):
d = {}
for R, V in zip(words, values):
if any(d.setdefault(v, c) != c for c, v in zip(R, V)): return False
return d
def checkio(crossword, words):
lines = [crossword[i] for i in (0, 2, 4)]
lines+= [[crossword[j][i] for j in range(5)] for i in (0, 2, 4)]
for perm in permutations(words):
if d:=match(perm, lines):
return [[d.get(c, ' ') for c in row] for row in crossword]
return None
Nov. 19, 2020
Comments: