From ebc193873c382bd814730e8ea3032604ebb4a851 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Wed, 25 Sep 2024 18:35:35 +0200 Subject: Change card ID to string --- src/scheduler_brutal.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/scheduler_brutal.py') diff --git a/src/scheduler_brutal.py b/src/scheduler_brutal.py index e4e7ee2..a476932 100644 --- a/src/scheduler_brutal.py +++ b/src/scheduler_brutal.py @@ -8,7 +8,7 @@ from random import shuffle HISTORY_DEPTH = 8 class SchedulerBrutal(Scheduler): - def __init__(self, cards: dict[int, Card], state: dict): + def __init__(self, cards: dict[str, Card], state: dict): self._cards = cards self._state = {} @@ -24,13 +24,13 @@ class SchedulerBrutal(Scheduler): self._state[id] = history - def practice(self, size: int) -> list[int]: + def practice(self, size: int) -> list[str]: return self._schedule(size) - def test(self, size: int) -> list[int]: + def test(self, size: int) -> list[str]: return self._schedule(size) - def update(self, results: dict[int, int]) -> None: + def update(self, results: dict[str, int]) -> None: # Add card result to sliding window, or None if card was not shown self._state = {id: history[1:] + [results.get(id, None)] for id, history in self._state.items()} @@ -51,7 +51,7 @@ class SchedulerBrutal(Scheduler): def _exposureIndex(history: list) -> float: return sum([i + 1 for i, h in enumerate(history) if h is not None]) - def _schedule(self, size: int) -> list[int]: + def _schedule(self, size: int) -> list[str]: weights = range(10, 10 + HISTORY_DEPTH) cards = [id for id, card in self._cards.items()] -- cgit v1.2.3