Last active
November 13, 2017 16:15
-
-
Save bobbzorzen/c13875a57ea7e4adefebe7b10b74b27c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_diagonal_match(matrix, y, x, searchLeft=False): | |
negator = -1 if searchLeft else 1 | |
match = True | |
if len(matrix) < y+5 or (len(matrix[y]) < x+5 and x-5 > 0): | |
match = False | |
for i in range(1, 5): | |
if not match: | |
break | |
newX = x + (negator*i) | |
match = matrix[y+i][newX] == matrix[y][x] | |
return match |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment