function [A u] = place_N_queens_cols_rows(N) % this function places N queens on the NxN board, % no two queens are in the same row or column. % Only diagonal attacks are possible. A = zeros(N); p = randperm(N); q = randperm(N); for i = 1 : N A(p(i), q(i)) = 1; end end