예제 #1
0
  private double calculateScorePart(int i, boolean enableLogging) {
    double score = 0.0;
    double partWeight, scaledQCount, avgLevel, scaledCorrectRatio;
    /** Calculate the normalized Number of words in current part */
    partWeight = QQUtils.PartWeight100[i] / 100;
    avgLevel = QParts.get(i).getAvgLevel();
    scaledQCount =
        QQUtils.sCurve(QParts.get(i).getNumCorrect(), QQUtils.Juz2SaturationQCount * partWeight);
    scaledQCount += 1;
    scaledCorrectRatio = QQUtils.sCurve(QParts.get(i).getCorrectRatio(), 1);

    score = 100 * partWeight * avgLevel * scaledQCount * scaledCorrectRatio;
    if (QQUtils.QQDebug == 1 && QParts.get(i).getNumCorrect() > 0 && enableLogging)
      Log.d(
          "["
              + i
              + "] S= "
              + new DecimalFormat("##.##")
                  .format(100 * partWeight * avgLevel * scaledQCount * scaledCorrectRatio)
              + "::pW="
              + new DecimalFormat("##.##").format(partWeight)
              + " av="
              + new DecimalFormat("##.##").format(avgLevel)
              + " sC="
              + new DecimalFormat("##.##").format(scaledQCount)
              + " sR="
              + new DecimalFormat("##.##").format(scaledCorrectRatio));
    return score;
  }
예제 #2
0
  public CharSequence getUpScore(int CurrentPart) {
    double currentPartScore, currentPartScoreUp;
    double partWeight, avgLevel, scaledQCount, scaledCorrectRatio;
    int numCorrect, numQuestions, currLevel;

    /**
     * Find the difference between the current and the to-be-incremented score The difference comes
     * from the current part only. The current is calculated normally, while the UP is calculated
     * manually as below
     */
    currentPartScore = calculateScorePart(CurrentPart, true);

    /** Calculate the normalized Number of words in current part + UP */
    numCorrect = QParts.get(CurrentPart).getNumCorrect();
    numQuestions = QParts.get(CurrentPart).getNumQuestions();
    currLevel = getLevel();

    partWeight = QQUtils.PartWeight100[CurrentPart] / 100;

    avgLevel = numCorrect * (QParts.get(CurrentPart).getAvgLevel()) + currLevel;
    avgLevel /= (numCorrect + 1);

    scaledQCount =
        QQUtils.sCurve(
            QParts.get(CurrentPart).getNumCorrect() + 1, QQUtils.Juz2SaturationQCount * partWeight);
    scaledQCount += 1;
    scaledCorrectRatio = QQUtils.sCurve(((float) numCorrect + 1) / ((float) numQuestions + 1), 1);

    currentPartScoreUp = 100 * partWeight * avgLevel * scaledQCount * scaledCorrectRatio;

    return String.valueOf((int) Math.round(currentPartScoreUp - currentPartScore));
  }
예제 #3
0
  public CharSequence getDownScore(int CurrentPart) {
    double currentPartScore, currentPartScoreDown;
    double partWeight, avgLevel, scaledQCount, scaledCorrectRatio;
    int numCorrect, numQuestions, downScore;

    /**
     * Find the difference between the current and the to-be-decremented score The difference comes
     * from the current part only. The current is calculated normally, while the DOWN is calculated
     * manually as below
     */
    currentPartScore = calculateScorePart(CurrentPart, false);

    /** Calculate the normalized Number of words in current part + UP */
    numCorrect = QParts.get(CurrentPart).getNumCorrect();
    numQuestions = QParts.get(CurrentPart).getNumQuestions();
    partWeight = QQUtils.PartWeight100[CurrentPart] / 100;

    avgLevel = QParts.get(CurrentPart).getAvgLevel();
    scaledQCount =
        QQUtils.sCurve(
            QParts.get(CurrentPart).getNumCorrect(), QQUtils.Juz2SaturationQCount * partWeight);
    scaledQCount += 1;
    scaledCorrectRatio = QQUtils.sCurve(((float) numCorrect) / ((float) numQuestions + 1), 1);

    currentPartScoreDown = 100 * partWeight * avgLevel * scaledQCount * scaledCorrectRatio;
    downScore = (int) Math.round(currentPartScore - currentPartScoreDown);
    if (QQUtils.QQDebug == 1 && downScore == 0) {
      Log.d(
          "[0Down] Sd= "
              + new DecimalFormat("##.##")
                  .format(100 * partWeight * avgLevel * scaledQCount * scaledCorrectRatio)
              + "::pW="
              + new DecimalFormat("##.##").format(partWeight)
              + " av="
              + new DecimalFormat("##.##").format(avgLevel)
              + " sC="
              + new DecimalFormat("##.##").format(scaledQCount)
              + " sR="
              + new DecimalFormat("##.##").format(scaledCorrectRatio));
    }
    return String.valueOf(downScore);
  }