summaryrefslogtreecommitdiffstats
path: root/src/scheduler_brutal.py
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2024-09-25 18:35:35 +0200
committerEddy Pedroni <epedroni@pm.me>2024-09-25 18:35:35 +0200
commitebc193873c382bd814730e8ea3032604ebb4a851 (patch)
tree7712cd78d0f97919946399627c0641b32baf4fba /src/scheduler_brutal.py
parent25546dad1f508f264b3224dd50dd42426d8b6aba (diff)
Change card ID to string
Diffstat (limited to 'src/scheduler_brutal.py')
-rw-r--r--src/scheduler_brutal.py10
1 files changed, 5 insertions, 5 deletions
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()]