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 true } for b = array[1 to 8].permute[] if solution[b] println[b]