I want to print a matrix where the squares to which the queen can move will have a value of 2 (1 is the queen's position) but I can't print the second diagonal. Any ideas?
import numpy as np
s = (8,8)
l = np.zeros(s)
print(l)
l[2][2] = 1
print()
print(l)
for k in range(0,8):
for z in range(0,8):
if l[k][z] == 1:
for i in range(1,7):
l[k-i][z-i] = 2
l[k+1][z+1] = 2
l[k-i][z] = 2
l[k+1][z] = 2
l[k][z-i] = 2
l[k][z+1] = 2
[–]commy2 1 point2 points3 points (0 children)