# Untitled

unknown
python
2 years ago
1.9 kB
2
Indexable
Never
```    # up-right sudoku
if(x > 8 and y < 9):
if (x > 11 and x < 15 and y > 5):
for i in range(6, 21):

if Matrix[y][i] == n:
return False

for i in range(0, 6):
if (Matrix[i][x-3] or Matrix[9][x-6] or Matrix[10][x-6] or Matrix[11][x-6] or Matrix[12][x] or Matrix[13][x] or Matrix[14][x]) == n:
return False

x0 = (x//3)*3
y0 = (y//3)*3
for i in range(0, 3):
for j in range(0, 3):
#  print(board[y0+i][x0+j])
if Matrix[y0+i][x0+j] == n:
return False
return True
# joint square
elif (y > 5 and x > 14):
for i in range(12, 21):
if Matrix[y][i] == n:
return False
for i in range(0, 6):
if (Matrix[i][x-3] or Matrix[6][x] or Matrix[7][x] or Matrix[8][x]) == n:
return False

x0 = (x//3)*3
y0 = (y//3)*3

for i in range(0, 3):
for j in range(0, 3):
#  print(board[y0+i][x0+j])
if Matrix[y0+i][x0+j] == n:
return False
return True
else:

for i in range(9, 18):
if Matrix[y][i] == n:
return False
for i in range(0, 6):
if (Matrix[i][x] or Matrix[6][x+3] or Matrix[7][x+3] or Matrix[8][x+3]) == n:
return False
x0 = (x//3)*3
y0 = (y//3)*3
for i in range(0, 3):
for j in range(0, 3):
#  print(board[y0+i][x0+j])
if Matrix[y0+i][x0+j] == n:
return False
return True
# down-right sudoku
```