def disambiguate_discovered_check(possibilities)
      DIRECTIONS.each do |attacking_piece, directions|
        attacking_piece = attacking_piece.upcase if self.move.black?

        directions.each do |dir|
          piece, square = first_piece(king_position, dir)
          next unless piece == self.move.piece && possibilities.include?(square)

          piece, _ = first_piece(square, dir)
          possibilities.reject! {|p| p == square } if piece == attacking_piece
        end
      end

      possibilities
    end
def disambiguate_discovered_check(possibilities)
      DIRECTIONS.each do |attacking_piece, directions|
        attacking_piece = attacking_piece.upcase if self.move.black?

        directions.each do |dir|
          piece, square = first_piece(king_position, dir)
          next unless piece == self.move.piece && possibilities.include?(square)

          piece, _ = first_piece(square, dir)
          possibilities.reject! {|p| p == square } if piece == attacking_piece
        end
      end

      possibilities
    end
A piece can't move if it would result in a discovered check.