N-queens problem: Difference between revisions
m
→Python: backtracking on permutations: Variable l replaced by h (1 and l look too similar in the source code)
m (→Python: backtracking on permutations: Minor cleanup) |
m (→Python: backtracking on permutations: Variable l replaced by h (1 and l look too similar in the source code)) |
||
Line 12,870:
if i < n:
for k in range(i, n):
if b[i + j] and c[i - j]:
a[i], a[k] = j,
b[i + j] = c[i - j] = False
yield from queen(i + 1)
b[i + j] = c[i - j] = True
a[i], a[k] =
else:
yield a
Line 12,898:
if i < n:
for k in range(i, n):
a[i], a[k] = j,
if b[i + j] and c[i - j]:
b[i + j] = c[i - j] = False
|