RosettaCodeData/Task/N-queens-problem/Frink/n-queens-problem.frink
2023-07-01 13:44:08 -04:00

12 lines
291 B
Text

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]