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
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
def rook_to(self): if self.flags & KINGSIDE: return p0x88_to_tuple(self._destination + W) else: return p0x88_to_tuple(self._destination + E)
def get_eliminated_pawn(self): return p0x88_to_tuple(self._destination + (N if self.color == BLACK else S))
def tuple(self): return ( p0x88_to_tuple(self._origin), p0x88_to_tuple(self._destination) )
def current_king_position(self): return p0x88_to_tuple(self._current_king_position())