mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-07 17:48:52 -06:00
Reduce time required to form non-daily habits; smooth out irregular schedules
This commit is contained in:
@@ -63,7 +63,7 @@ public final class Score
|
||||
double previousScore,
|
||||
double checkmarkValue)
|
||||
{
|
||||
double multiplier = pow(0.5, frequency / 13.0);
|
||||
double multiplier = pow(0.5, sqrt(frequency) / 13.0);
|
||||
|
||||
double score = previousScore * multiplier;
|
||||
score += checkmarkValue * (1 - multiplier);
|
||||
|
||||
@@ -275,6 +275,15 @@ public abstract class ScoreList implements Iterable<Score>
|
||||
final double freq = habit.getFrequency().toDouble();
|
||||
final int[] checkmarkValues = habit.getCheckmarks().getValues(from, to);
|
||||
|
||||
// For non-daily boolean habits, we double the numerator and the denominator to smooth
|
||||
// out irregular repetition schedules (for example, weekly habits performed on different
|
||||
// days of the week)
|
||||
if (!habit.isNumerical() && freq < 1.0)
|
||||
{
|
||||
numerator *= 2;
|
||||
denominator *= 2;
|
||||
}
|
||||
|
||||
List<Score> scores = new LinkedList<>();
|
||||
|
||||
for (int i = 0; i < checkmarkValues.length; i++)
|
||||
|
||||
Reference in New Issue
Block a user