You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
949 B

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, actions: List[Optional[Any]], round_id: int) -> Tuple[Any, List[int]]:
return {}, [0] * teams_count # new_state, add_points for each team
def validate_step(self, state: Any, team_id: int, action: 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
@add_logic
class Occupy(Logic):
pass