# Untitled

unknown
plain_text
2 years ago
6.0 kB
1
Indexable
Never
```def checkNumberCenter(x, y, n):
#upleft
if( x > 5 and x < 9 and y > 5 and y < 9  ):
for i in range(0, 15):
# print(board[y][i])
if Matrix[y][i] == n:
return False

for i in range(0, 9):
# print(board[i][x])
if Matrix[i][x]  == n:
return False
if Matrix[9][x-6] == n:
return False
elif Matrix[10][x-6] == n:
return False
elif Matrix[11][x-6] == n:
return False
for i in range(12, 15):
if Matrix[i][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
#upright
if(x > 11 and x < 15 and y > 5 and y < 9):
for i in range(6, 21):

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

for i in range(0, 6):
if Matrix[i][x-3]  == n:
return False
if Matrix[9][x-6] == n:
return False
elif Matrix[10][x-6] == n:
return False
elif Matrix[11][x-6] == n:
return False
for i in range(12, 15):
if Matrix[i][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
#downright
if (x > 11 and x < 15 and y < 15 and  y>11):
if (x > 11 and x < 15 and y < 15):
for i in range(9, 21):
if Matrix[y][i] == n:
return False

for i in range(6, 21):
if Matrix[i][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
#downleft
if(x < 9 and y > 11 and x>5 and y<15):
for i in range(0, 12):
# print(Matrix[y][i])
if Matrix[y][i] == n:
return False
if Matrix[6][x] == n:
return False
elif Matrix[7][x] == n:
return False
elif Matrix[8][x] == n:
return False
for i in range(12, 21):
# print(Matrix[i][x])
if (Matrix[i][x]) == n:
return False
if Matrix[9][x-6]  == n:
return False
elif Matrix[10][x-6] == n:
return False
elif Matrix[11][x-6] == 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
if(x > 8 and x < 12) and (y > 5 and y < 9):
for i in range(6, 15):
# print(Matrix[y][i])
if Matrix[y][i] == n:
return False

for i in range(6, 9):
# print(Matrix[i][x])
if Matrix[i][x] == n:
return False
for i in range(9, 12):
# print(Matrix[i][x])
if Matrix[i][x-6] == n:
return False
for i in range(12, 15):
# print(Matrix[i][x])
if Matrix[i][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
# down-middle 3*3 square
if(x > 8 and x < 12) and (y > 11 and y < 15):
for i in range(6, 15):
print(Matrix[y][i])
if Matrix[y][i] == n:
return False

for i in range(6, 9):
# print(Matrix[i][x])
if Matrix[i][x] == n:
return False
for i in range(9, 12):
# print(Matrix[i][x])
if Matrix[i][x-6] == n:
return False
for i in range(12, 15):
# print(Matrix[i][x])
if Matrix[i][x] == n:
return False

x0 = (x//3)*3
y0 = (y//3)*3
for i in range(0, 3):
for j in range(0, 3):
if Matrix[y0+i][x0+j] == n:
return False
return True
# middle 6*3
if(x < 9 and y > 8 and y < 12):
for i in range(0, 9):
print(Matrix[y][i])
if Matrix[y][i] == n:
return False

for i in range(6, 9):
# print(Matrix[i][x])
if Matrix[i][x+6] == n:
return False
for i in range(9, 12):
# print(Matrix[i][x])
if Matrix[i][x] == n:
return False
for i in range(12, 15):
# print(Matrix[i][x])
if Matrix[i][x+6] == 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

```