In the code, 8 is the symbol for attacked 1 is the symbol for queen and 0 is the symbol for empty space
Info
This question is closed. Reopen it to edit or answer.
How can I change rows and and diagonals in an array of size NxN
1 view (last 30 days)
Show older comments
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 Comment
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!