Created
January 6, 2019 20:29
-
-
Save cggonzal/a55024a2382d261ac8613b0b1ec2742e 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 attackViaCol(self,pos): | |
for queen in self.queenPositions: | |
if(pos[1] == queen[1] and queen != pos): # last inqueality checks to make sure you arent comparing the same queen | |
return True | |
return False | |
def attackViaRow(self,pos): | |
for queen in self.queenPositions: | |
if(pos[0] == queen[0] and queen != pos): | |
return True | |
return False | |
def attackViaDiagonal(self,pos): | |
for queen in self.queenPositions: | |
if (abs(queen[0] - pos[0]) == abs(queen[1] - pos[1]) and queen != pos): | |
return True | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment