N-queens problem: Difference between revisions
Added Uiua solution
m (→Python: Backtracking on permutations: Restored the original look) |
(Added Uiua solution) |
||
Line 16,568:
|_|_|_|Q|_|_|
|_|Q|_|_|_|_|</pre>
=={{header|Uiua}}==
`Good` checks that a (maybe partial) solution is valid.
<syntaxhighlight lang="Uiua">
N ← 8
Good ← =1⧻◴[⧻◴ ⟜(∩(⧻◴)⊃(+|-)⇡⧻.)⟜⧻]
⍥(⊏⊚≡Good.↯⊟∞⧻⊢⊢⟜♭⊞⊂⇡N)7⇡N
</syntaxhighlight>
{{out}}
<pre>
╭─
╷ 0 4 7 5 2 6 1 3
0 5 7 2 6 3 1 4
0 6 3 5 7 1 4 2
etc
</pre>
=={{header|UNIX Shell}}==
|