RosettaCodeData/Task/N-queens-problem/Frink/n-queens-problem.frink

13 lines
291 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
solution[board] :=
{
for q = 0 to length[board] - 1
for c = q+1 to length[board] - 1
if board@q == board@c + (c - q) or board@q == board@c - (c - q)
return false
return true
}
for b = array[1 to 8].permute[]
if solution[b]
println[b]