valanga 0.1.6__py3-none-any.whl → 0.1.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- valanga/representation_factory.py +26 -12
- {valanga-0.1.6.dist-info → valanga-0.1.7.dist-info}/METADATA +1 -1
- {valanga-0.1.6.dist-info → valanga-0.1.7.dist-info}/RECORD +6 -6
- {valanga-0.1.6.dist-info → valanga-0.1.7.dist-info}/WHEEL +0 -0
- {valanga-0.1.6.dist-info → valanga-0.1.7.dist-info}/licenses/LICENSE +0 -0
- {valanga-0.1.6.dist-info → valanga-0.1.7.dist-info}/top_level.txt +0 -0
|
@@ -3,23 +3,35 @@ Factory for creating content representations from game states and state modifica
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
from dataclasses import dataclass
|
|
6
|
-
from typing import
|
|
6
|
+
from typing import Protocol
|
|
7
7
|
|
|
8
|
-
from .game import State
|
|
8
|
+
from .game import State
|
|
9
9
|
from .represention_for_evaluation import ContentRepresentation
|
|
10
10
|
|
|
11
|
-
StateT = TypeVar("StateT", bound=State)
|
|
12
|
-
EvalIn = TypeVar("EvalIn")
|
|
13
11
|
|
|
14
|
-
CreateFromState
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
class CreateFromState[StateT: State, EvalIn](Protocol):
|
|
13
|
+
"""
|
|
14
|
+
Protocol for creating a state representation from a state.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __call__(self, state: StateT) -> ContentRepresentation[StateT, EvalIn]: ...
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class CreateFromStateAndModifications[StateT: State, EvalIn, StateModT](Protocol):
|
|
21
|
+
"""
|
|
22
|
+
Protocol for creating a state representation from a state and modifications.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
def __call__(
|
|
26
|
+
self,
|
|
27
|
+
state: StateT,
|
|
28
|
+
state_modifications: StateModT,
|
|
29
|
+
previous_state_representation: ContentRepresentation[StateT, EvalIn],
|
|
30
|
+
) -> ContentRepresentation[StateT, EvalIn]: ...
|
|
19
31
|
|
|
20
32
|
|
|
21
33
|
@dataclass
|
|
22
|
-
class RepresentationFactory[StateT: State, EvalIn]:
|
|
34
|
+
class RepresentationFactory[StateT: State, EvalIn, StateModT]:
|
|
23
35
|
"""Factory for creating content representations from states and state modifications.
|
|
24
36
|
Attributes:
|
|
25
37
|
create_from_state: Function to create a content representation from a state.
|
|
@@ -27,13 +39,15 @@ class RepresentationFactory[StateT: State, EvalIn]:
|
|
|
27
39
|
"""
|
|
28
40
|
|
|
29
41
|
create_from_state: CreateFromState[StateT, EvalIn]
|
|
30
|
-
create_from_state_and_modifications:
|
|
42
|
+
create_from_state_and_modifications: CreateFromStateAndModifications[
|
|
43
|
+
StateT, EvalIn, StateModT
|
|
44
|
+
]
|
|
31
45
|
|
|
32
46
|
def create_from_transition(
|
|
33
47
|
self,
|
|
34
48
|
state: StateT,
|
|
35
49
|
previous_state_representation: ContentRepresentation[StateT, EvalIn] | None,
|
|
36
|
-
modifications:
|
|
50
|
+
modifications: StateModT | None,
|
|
37
51
|
) -> ContentRepresentation[StateT, EvalIn]:
|
|
38
52
|
"""Creates a content representation from a state transition.
|
|
39
53
|
Args:
|
|
@@ -6,10 +6,10 @@ valanga/over_event.py,sha256=jUqN3CXq3e55TvDZatZKFlEOzJfho7M1Zr7VjZUhP6M,7908
|
|
|
6
6
|
valanga/policy.py,sha256=TkqcOSePRhHqtuoMbCKe5qZbizvF5H9uG1_oEcIZsuA,1229
|
|
7
7
|
valanga/progress_messsage.py,sha256=3LnOXSgyU84UkwcpsakcbPt_d3el2ojRSUClAwoPyEk,361
|
|
8
8
|
valanga/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
valanga/representation_factory.py,sha256=
|
|
9
|
+
valanga/representation_factory.py,sha256=LAIfLCBKTMVPDCZbcRtMQs_VIJwIHeaEH86BWV8PgTc,2456
|
|
10
10
|
valanga/represention_for_evaluation.py,sha256=9yCCOuN-h9FnoLJrffKGQ-oXiiXzZT3rP4e5wwMYfys,1135
|
|
11
|
-
valanga-0.1.
|
|
12
|
-
valanga-0.1.
|
|
13
|
-
valanga-0.1.
|
|
14
|
-
valanga-0.1.
|
|
15
|
-
valanga-0.1.
|
|
11
|
+
valanga-0.1.7.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
12
|
+
valanga-0.1.7.dist-info/METADATA,sha256=4qCW9MTi80M1_3RJSi2hNiQlqV70UbzaZ0_YbdRvjTU,44645
|
|
13
|
+
valanga-0.1.7.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
14
|
+
valanga-0.1.7.dist-info/top_level.txt,sha256=cKFLhxKDTqygHnc0xc_L8jDx6oNu5hSHqZ4UExU4xPo,8
|
|
15
|
+
valanga-0.1.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|