# Code generators

Domain specification

Domain
Create Domain
from enum import Enum
from typing import *

from skdecide import *
from skdecide.builders.domain import *


# Example of State type (adapt to your needs)
class State(NamedTuple):
    x: int
    y: int


# Example of Action type (adapt to your needs)
class Action(Enum):
    up = 0
    down = 1
    left = 2
    right = 3


class D(Domain):
    T_state = State  # Type of states
    T_observation = T_state  # Type of observations
    T_event = Action  # Type of events
    T_value = float  # Type of transition values (rewards or costs)
    T_info = None  # Type of additional information in environment outcome


class MyDomain(D):
    
    def _state_step(self, action: StrDict[list[D.T_event]]) -> TransitionOutcome[D.T_state, StrDict[Value[D.T_value]], StrDict[D.T_predicate], StrDict[D.T_info]]:
        pass
    
    def _get_action_space_(self) -> StrDict[Space[D.T_event]]:
        pass
    
    def _get_applicable_actions_from(self, memory: Memory[D.T_state]) -> StrDict[Space[D.T_event]]:
        pass
    
    def _get_enabled_events_from(self, memory: Memory[D.T_state]) -> Space[D.T_event]:
        pass
    
    def _get_observation_distribution(self, state: D.T_state, action: Optional[StrDict[list[D.T_event]]] = None) -> Distribution[StrDict[D.T_observation]]:
        pass
    
    def _get_observation_space_(self) -> StrDict[Space[D.T_observation]]:
        pass