code: @SuppressWarnings("unused")
      private static double match_bitapScore(int e, int x, int loc, String pattern) {
          float accuracy = (float) e / pattern.length();
          int proximity = Math.abs(loc - x);
          if (Match_Distance == 0) {
              // Dodge divide by zero error.
              return proximity == 0 ? accuracy : 1.0;
          }
          return accuracy + (proximity / (float) Match_Distance);
      }
docs: Compute and return the score for a match with e errors and x location.
  
  @param e
  Number of errors in match.
  @param x
  Location of match.
  @param loc
  Expected location of match.
  @param pattern
  Pattern being sought.
  @return Overall score for match (0.0 = good, 1.0 = bad).