# Untitled

unknown
plain_text
2 years ago
1.9 kB
1
Indexable
Never
# down-right sudoku
if(x > 8 and y > 11):
if (x > 11 and x < 15 and y < 15):
for i in range(6, 21):

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

for i in range(15, 21):
if (Matrix[i][x-3] or Matrix[9][x-6] or Matrix[10][x-6] or Matrix[11][x-6] 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

elif (y < 15 and x > 14):
for i in range(12, 21):
if Matrix[y][i] == n:
return False
for i in range(15, 21):
if (Matrix[i][x-3] 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
else:

for i in range(9, 18):
if Matrix[y][i] == n:
return False
for i in range(15, 21):
if (Matrix[i][x] or Matrix[12][x+3] or Matrix[13][x+3] or Matrix[14][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