from typing import Any, List, Tuple, Union, Optional logic_by_mode = {} def add_logic(cls): logic_by_mode[cls.__name__.lower()] = cls class Logic: def __init__(self, teams_count: int, configuration: Any): self.teams_count = teams_count self.configuration = configuration def zero_state(self) -> Any: return {} def step(self, state: Any, moves: List[Optional[Any]], round_id: int) -> Tuple[Any, List[int]]: return {}, [0] * self.teams_count # new_state, add_points for each team def validate_move(self, state: Any, team_id: int, move: Any, round_id: int) -> Union[None, Any]: return None # Bez chyby # return {"status": "warning", ... } # Drobná chyba, ale tah provedu # throw Exception("Chybí povinná ...") # Zásadní chyba, tah neuznán # Když používají našeho klienta, tak by se toto nemělo stát def personalize_state(self, state: Any, team_id: int, round_id: int) -> Any: return state @add_logic class Occupy(Logic): pass