update 2024.12.04 14:54
This commit is contained in:
@@ -17,10 +17,34 @@ filename = getFilename2Data(aocDay)
|
||||
def checkNextChar(inputChar):
|
||||
return 0
|
||||
|
||||
def countXMAS2(data):
|
||||
def countXMAS3(data):
|
||||
#ret = re2.findall("M.M\n.A.\nS.S", data, rotate=True)
|
||||
|
||||
|
||||
for i in range(n):
|
||||
for j in range(n):
|
||||
if word_search[i][j] != 'A':
|
||||
continue
|
||||
if not is_inbounds(i+1, j+1):
|
||||
continue
|
||||
if not is_inbounds(i+1, j-1):
|
||||
continue
|
||||
if not is_inbounds(i-1, j+1):
|
||||
continue
|
||||
if not is_inbounds(i-1, j-1):
|
||||
continue
|
||||
if not (word_search[i-1][j-1], word_search[i+1][j+1]) in (('M', 'S'), ('S', 'M')):
|
||||
continue
|
||||
if not (word_search[i+1][j-1], word_search[i-1][j+1]) in (('M', 'S'), ('S', 'M')):
|
||||
continue
|
||||
result += 1
|
||||
|
||||
return 0
|
||||
|
||||
def countXMAS2(dataMatrix,searchWord):
|
||||
for x in range(len(dataMatrix)):
|
||||
for y in range(len(dataMatrix[x])):
|
||||
if dataMatrix[x][y] == searchWord[1:2]:
|
||||
|
||||
|
||||
def countXMAS(dataMatrix,searchWord):
|
||||
|
||||
Reference in New Issue
Block a user