Beispiel #1
0
 def isValid( self, grid, point ):
     """ A church cannot be diagonal to another church.  """
     if not super( Church, self ).isValid( grid, point ):
         return False
     
     for grid_x, grid_y in grid.points():
         if isDiagonalPoint( point, (grid_x, grid_y) ):
             if self.atPoint( grid, (grid_x, grid_y) ):
                 return False
     return True
Beispiel #2
0
 def isValid( self, grid, point ):
     """ A bishop can only be placed diagonally to another Bishop. """
     if not super( Bishop, self ).isValid( grid, point ):
         return False
     
     # If there isn't a bishop on the board, there won't ever be a way to place one! 
     if not self.existsOnTheBoard( grid ): 
         return True
     
     for grid_x, grid_y in grid.points():
         if isDiagonalPoint( point, (grid_x, grid_y) ):
             if self.atPoint( grid, (grid_x, grid_y) ):
                 return True
          
     return False