summaryrefslogtreecommitdiffstats
path: root/src/scheduler.py
blob: 575ec9d08549dc8558acd21d04a36ef0ef447ec1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from typing import Protocol
from abc import abstractmethod
from card import Card

class Scheduler(Protocol):
    @abstractmethod
    def __init__(self, cards: dict[str, Card], state: dict): raise NotImplementedError

    @abstractmethod
    def practice(self, size: int) -> list[str]: raise NotImplementedError

    @abstractmethod
    def test(self, size: int) -> list[str]: raise NotImplementedError

    @abstractmethod
    def update(self, results: dict[str, 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}")