diff options
author | Eddy Pedroni <epedroni@pm.me> | 2024-10-16 22:25:47 +0200 |
---|---|---|
committer | Eddy Pedroni <epedroni@pm.me> | 2024-10-16 22:30:41 +0200 |
commit | 81949cce8b03703605b2b54d89f37e27617fa0d0 (patch) | |
tree | fc141b376806e1b4fc2f34cab2264c3517e47f97 | |
parent | 8dd549b560ec3b7b1ef0fa7a64f421ad4ab28a93 (diff) |
Expose index calculation is now quadratically weighted to avoid duplicates in the test
-rw-r--r-- | flashcards-project/src/flashcards/scheduler_brutal.py | 2 | ||||
-rw-r--r-- | tests/scheduler_brutal_unittest.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/flashcards-project/src/flashcards/scheduler_brutal.py b/flashcards-project/src/flashcards/scheduler_brutal.py index f2a00c2..f98729c 100644 --- a/flashcards-project/src/flashcards/scheduler_brutal.py +++ b/flashcards-project/src/flashcards/scheduler_brutal.py @@ -59,7 +59,7 @@ class SchedulerBrutal(Scheduler): """ Exposure index is a measure of how much and how recently a card has been shown """ - return sum([i + 1 for i, h in enumerate(history) if h is not None]) + return sum([pow(i + 1, 2) for i, h in enumerate(history) if h is not None]) def _schedule(self, size: int) -> list[str]: weights = range(10, 10 + HISTORY_DEPTH) diff --git a/tests/scheduler_brutal_unittest.py b/tests/scheduler_brutal_unittest.py index a87e5e9..4790016 100644 --- a/tests/scheduler_brutal_unittest.py +++ b/tests/scheduler_brutal_unittest.py @@ -26,7 +26,7 @@ def test_scheduling(): "9": [None, None, None], } - expected_priority = ["9", "6", "5", "7", "8", "4", "1", "3", "2", "0"] + expected_priority = ["9", "6", "5", "8", "7", "4", "1", "3", "2", "0"] uut = UUT(cards, state) |