Example #1
0
 def hindered(self, color):
     result = set()
     attack_moves = self.attack_moves(-1, color)
     for move in attack_moves:
         result.add(
             p0x88_to_tuple(move.destination())
         )
     return result
Example #2
0
    def get_pieces(self):
        if self.hash != self.last_hash:
            pieces_list = []

            for i in range(A8, H1 + 1):
                if is_not_square(i):
                    i = i + 7
                    continue

                if (self.pieces[i] == PIECE_EMPTY or
                        self.colors[i] == COLOR_EMPTY):
                    continue

                pieces_list.append(Piece(
                    name=NAMES[self.pieces[i]],
                    position=p0x88_to_tuple(i),
                    color="white" if self.colors[i] == WHITE else "black",
                ))
            self.pieces_list = pieces_list
            self.last_hash = self.hash
        return self.pieces_list
Example #3
0
 def rook_to(self):
     if self.flags & KINGSIDE:
         return p0x88_to_tuple(self._destination + W)
     else:
         return p0x88_to_tuple(self._destination + E)
Example #4
0
 def get_eliminated_pawn(self):
     return p0x88_to_tuple(self._destination +
                           (N if self.color == BLACK else S))
Example #5
0
 def tuple(self):
     return (
         p0x88_to_tuple(self._origin),
         p0x88_to_tuple(self._destination)
     )
Example #6
0
 def current_king_position(self):
     return p0x88_to_tuple(self._current_king_position())