Exemplo n.º 1
0
 def validMoves( self, squares ):
     moves = []
     for i in DIRECTIONS:
         newmoves = square.line( squares, self.pos, i , False )
         if( len(newmoves) > 1 ):
             if not self._isOppositeSide( squares[newmoves[-1]] ):
                 # remove last square becaues it is an allie
                 newmoves = newmoves[0:-1]
         elif( len(newmoves) == 1 ):
             if not self._isOppositeSide( squares[newmoves[0]] ):
                 newmoves = []
         moves.extend( newmoves )
     return moves
Exemplo n.º 2
0
 def validMoves( self, squares ):
     moves = []
     for i in STRAIGHT_DIR:
         newmoves = square.line( squares, self.pos, i , False )
         if( len(newmoves) > 1 ):
             if not self._isOppositeSide( squares[newmoves[-1]] ):
                 # remove last square becaues it is an allie
                 newmoves = newmoves[0:-1]
         elif( len(newmoves) == 1 ):
             if not self._isOppositeSide( squares[newmoves[0]] ):
                 # the only move is to a square containing an allie
                 newmoves = []
         moves.extend( newmoves )
     return moves
Exemplo n.º 3
0
 def squaresAttacked( self, squares ):
     attackedSquares = []
     for i in DIRECTIONS:
         newSqrs = square.line( squares, self.pos, i , True )
         attackedSquares.extend( newSqrs )
     return attackedSquares
Exemplo n.º 4
0
 def squaresAttacked( self, squares ):
     attackedSquares = []
     for i in STRAIGHT_DIR:
         newSqrs = square.line( squares, self.pos, i , True )
         attackedSquares.extend( newSqrs )
     return attackedSquares