# 尝试检测相同的平方数

``````lisr = [[1, 1, 0, 0, 0, 1, 0, 0],
[1, 1, 0, 0, 0, 1, 1, 1],
[0, 1, 0, 1, 0, 1, 1, 0],
[1, 1, 0, 1, 0, 0, 1, 1],
]
def squareRec(y, x):
freshhold = 0
for n in range(x, len(lisr[y])):
if n == len(lisr[y])-1 or lisr[y][x] != lisr[y][n]:
if n == len(lisr[y])-1: n += 1
freshhold = n
break
for i in range(y, len(lisr)):
for n in range(x, freshhold):
if (lisr[y][x] != lisr[i][n]) or (i == len(lisr)-1 and n == freshhold-1):
if i == len(lisr)-1: i -= 1
point1,point2,point3,point4 = (y,x), (y,freshhold-1), (y+i-1,x), (y+i-1,freshhold-1)
return(point1,point2,point3,point4)
def nullOut(point1, point2):
for i in range(point1[0], point2[0]+1):
for n in range(point1[1], point2[1]+1):
lisr[i][n] = None
##point1, point2, point3, point4 = squareRec(0, 7)
##print(point1, point2, point3, point4)
##nullOut(point1, point4)
##for p in range(len(lisr)): print(lisr[p])
for i in range(len(lisr)):
for n in range(len(lisr[i])):
if lisr[i][n] != None:
point1, point2, point3, point4 = squareRec(i, n)
nullOut(point1, point4)
for p in range(len(lisr)): print(lisr[p])
print()
``````