summaryrefslogtreecommitdiffstats
path: root/src/scheduler_brutal.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/scheduler_brutal.py')
-rw-r--r--src/scheduler_brutal.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/scheduler_brutal.py b/src/scheduler_brutal.py
index a476932..f0bfe99 100644
--- a/src/scheduler_brutal.py
+++ b/src/scheduler_brutal.py
@@ -1,6 +1,3 @@
-"""
-"""
-
from scheduler import Scheduler
from card import Card
from random import shuffle
@@ -8,6 +5,14 @@ from random import shuffle
HISTORY_DEPTH = 8
class SchedulerBrutal(Scheduler):
+ """
+ The brutal scheduler tracks how well the player has consolidated each card
+ and also how often the card has been shown.
+
+ Using this information, it prioritizes cards that have been shown less
+ frequently and recently, which means the player will often see totally new
+ cards in test sessions.
+ """
def __init__(self, cards: dict[str, Card], state: dict):
self._cards = cards
self._state = {}
@@ -38,17 +43,21 @@ class SchedulerBrutal(Scheduler):
def getState(self) -> dict:
return self._state
- # Consolidation index is a measure of how well the card has been memorised
@staticmethod
def _consolidationIndex(history: list, weights: range) -> float:
+ """
+ Consolidation index is a measure of how well the player has guessed the card recently
+ """
relevant_history = [(h, w) for h, w in zip(history, weights) if h is not None]
weighted_history = sum([h * w for h, w in relevant_history])
total_weights = sum([w for h, w in relevant_history])
return weighted_history / total_weights if total_weights > 0 else 0.0
- # Exposure index is a measure of how much and how recently a card has been shown
@staticmethod
def _exposureIndex(history: list) -> float:
+ """
+ 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])
def _schedule(self, size: int) -> list[str]: