Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How can I change rows and and diagonals in an array of size NxN

1 visualización (últimos 30 días)
Shawn Blancett
Shawn Blancett el 15 de Sept. de 2017
Cerrada: Walter Roberson el 15 de Sept. de 2017
Below is the code im starting for a "queens project" where you place queens on a board so they cant attack eachother, My professor said that there was a tool I could use where once I found a queen in my board that I could change all the queens in that column to show it was "attacked" by using the "*" function but it isnt working when I do it.
Any ideas?
it should be line 12 where im having the issues
N = input('boardsize ')
X = zeros(N);
for k=1:N
random = randi([1,N]);
X(k,random) = 1;
end
X
index = find([X] == 1)
for i = 1:N
for j = 1:N
if(X(i,j) == 1)
X(*,j) = 8// trying to figure out
end
end
end
  1 comentario
Shawn Blancett
Shawn Blancett el 15 de Sept. de 2017
In the code, 8 is the symbol for attacked 1 is the symbol for queen and 0 is the symbol for empty space

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by