summaryrefslogtreecommitdiffstats
path: root/src/scheduler.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/scheduler.py')
-rw-r--r--src/scheduler.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/scheduler.py b/src/scheduler.py
new file mode 100644
index 0000000..67e204a
--- /dev/null
+++ b/src/scheduler.py
@@ -0,0 +1,30 @@
+from typing import Protocol
+from abc import abstractmethod
+from card import Card
+
+class Scheduler(Protocol):
+ @abstractmethod
+ def __init__(self, cards: dict[int, Card], state: dict): raise NotImplementedError
+
+ @abstractmethod
+ def practice(self, size: int) -> list[int]: raise NotImplementedError
+
+ @abstractmethod
+ def test(self, size: int) -> list[int]: raise NotImplementedError
+
+ @abstractmethod
+ def update(self, results: dict[int, int]) -> None: raise NotImplementedError
+
+ @abstractmethod
+ def getState(self) -> dict: raise NotImplementedError
+
+SCHEDULERS = ["brutal"]
+
+def getSchedulerClass(name: str) -> Scheduler:
+ match name:
+ case "brutal":
+ from scheduler_brutal import SchedulerBrutal
+ return SchedulerBrutal
+ case _:
+ raise Exception(f"Unknown scheduler: {name}")
+