summaryrefslogtreecommitdiffstats
path: root/src/scheduler.py
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2024-09-25 16:12:53 +0200
committerEddy Pedroni <epedroni@pm.me>2024-09-25 16:12:53 +0200
commit28afae563e3e32187b389db4680bcc08b9fc55a9 (patch)
tree0cb940560297401924316f3fc7226bd7983eb2ad /src/scheduler.py
parentfe36d1261dc96004e4d4e692a65e1bc53137726b (diff)
General improvements, CLI initial implementation
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}")
+