valanga 0.1.11__tar.gz → 0.1.13__tar.gz
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-0.1.11 → valanga-0.1.13}/PKG-INFO +1 -1
- {valanga-0.1.11 → valanga-0.1.13}/pyproject.toml +1 -1
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga/policy.py +6 -3
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga.egg-info/PKG-INFO +1 -1
- {valanga-0.1.11 → valanga-0.1.13}/LICENSE +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/README.md +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/setup.cfg +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga/__init__.py +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga/evaluations.py +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga/evaluator_types.py +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga/game.py +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga/over_event.py +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga/progress_messsage.py +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga/py.typed +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga/representation_factory.py +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga/represention_for_evaluation.py +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga.egg-info/SOURCES.txt +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga.egg-info/dependency_links.txt +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga.egg-info/requires.txt +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/src/valanga.egg-info/top_level.txt +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/tests/test_over_event.py +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/tests/test_placeholder.py +0 -0
- {valanga-0.1.11 → valanga-0.1.13}/tests/test_representation_factory.py +0 -0
|
@@ -3,7 +3,7 @@ Policy-related classes and protocols for branch selection in game trees.
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
from dataclasses import dataclass
|
|
6
|
-
from typing import Mapping, Protocol
|
|
6
|
+
from typing import Mapping, Protocol, TypeVar
|
|
7
7
|
|
|
8
8
|
from valanga.evaluations import StateEvaluation
|
|
9
9
|
from valanga.game import BranchKey, BranchName, Seed, State
|
|
@@ -28,10 +28,13 @@ class Recommendation:
|
|
|
28
28
|
branch_evals: Mapping[BranchName, StateEvaluation] | None = None
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
StateT_contra = TypeVar("StateT_contra", bound=State, contravariant=True)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class BranchSelector(Protocol[StateT_contra]):
|
|
32
35
|
"""Protocol for a branch selector."""
|
|
33
36
|
|
|
34
|
-
def recommend(self, state:
|
|
37
|
+
def recommend(self, state: StateT_contra, seed: Seed) -> Recommendation:
|
|
35
38
|
"""Given a state and a seed, recommends a branch to take.
|
|
36
39
|
Args:
|
|
37
40
|
state (State): The current state of the game.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|