algorhino-anemone 0.1.8__py3-none-any.whl → 0.1.10__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: algorhino-anemone
3
- Version: 0.1.8
3
+ Version: 0.1.10
4
4
  Summary: anemone searches trees
5
5
  Author-email: Victor Gabillon <victorgabillon@gmail.com>
6
6
  License-Expression: GPL-3.0-only
@@ -12,8 +12,8 @@ Classifier: Operating System :: OS Independent
12
12
  Requires-Python: >=3.13
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: valanga>=0.1.9
16
- Requires-Dist: atomheart>=0.1.2
15
+ Requires-Dist: valanga>=0.1.13
16
+ Requires-Dist: atomheart>=0.1.6
17
17
  Requires-Dist: rich
18
18
  Requires-Dist: sortedcollections>=2.1.0
19
19
  Requires-Dist: graphviz
@@ -1,9 +1,9 @@
1
- algorhino_anemone-0.1.8.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
1
+ algorhino_anemone-0.1.10.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
2
2
  anemone/__init__.py,sha256=iKX9OGJxbyIqe9Fy-xxZY6sdH7WcG4RFyPR0WBai7Ls,942
3
- anemone/basics.py,sha256=wKagPFuxXhDQbjTuM1Qjh37HcJt0m39NBMDg2dc2M6M,188
4
- anemone/factory.py,sha256=tk26eSa8r0tGj5L7dc8-RQ1deEovyBxuDEuIbIn1I7c,6252
3
+ anemone/basics.py,sha256=plCN-SfAcCj4TPDVD3r19Q36UFjiKmNvuEyPH0kQ7Qs,574
4
+ anemone/factory.py,sha256=V4uretydlF0ykyq4ybn28GkctrOv7-78RSsxOJsQgPg,6146
5
5
  anemone/state_transition.py,sha256=fxvHZOYRtWV5ExXRIoehdRg9qV6zhgiE5uiCeOc80Dc,1418
6
- anemone/tree_and_value_branch_selector.py,sha256=9m7cWzw_nsFKiqZ4l7B2fz0lZ9HZ2NUNH2flZpaaQvQ,3479
6
+ anemone/tree_and_value_branch_selector.py,sha256=2K3AprInjzTIMm1sQsL4B33hljZcT-ToQfwpQrrRk5o,3455
7
7
  anemone/tree_exploration.py,sha256=cg1iTp3j9p9jUNjm07ogbflX8VC15AV8GEhGz3g1YNU,10529
8
8
  anemone/indices/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  anemone/indices/index_manager/__init__.py,sha256=P49ofGrnP_Nfmv63Rg_-Zvwn5NFvFFDQ3MD3GMeWNWw,515
@@ -22,7 +22,7 @@ anemone/node_evaluation/node_tree_evaluation/node_minmax_evaluation.py,sha256=Ju
22
22
  anemone/node_evaluation/node_tree_evaluation/node_tree_evaluation.py,sha256=fHAKN_8vriERrfKfr_qDH-y7El6HBYFXHOe9eFFCDUw,4260
23
23
  anemone/node_evaluation/node_tree_evaluation/node_tree_evaluation_factory.py,sha256=UY1glqflqMOqOPAHhtuzJ8QhGOp55Y9InqdhCMt9KJ8,1279
24
24
  anemone/node_factory/__init__.py,sha256=qhbX58hu8-TdFof5zo3ibfPFvF-OWNSgJf3RDMrtyTQ,553
25
- anemone/node_factory/algorithm_node_factory.py,sha256=mBaIG_9d29N0Lp5vZsqOQPPQEmAJlWxic5LOyvKNrw8,4167
25
+ anemone/node_factory/algorithm_node_factory.py,sha256=Pz0YYPqsuKaRiOhL9gJdEBPXEFepZNr_mZ_Ib94OVHs,4106
26
26
  anemone/node_factory/base.py,sha256=t_immiv-BDrPeQTUiOqvZLSlUq0zA2IbnM5Rweqv_n8,2134
27
27
  anemone/node_selector/__init__.py,sha256=DThR5UV-4WZG4PT5Lo0RPv9_P83ixFGfOSFoGihKtuA,1320
28
28
  anemone/node_selector/branch_explorer.py,sha256=3ywYkJe2R1Dg5nhmDXCgyhex85bT39Ql7ifRY--9Z_A,2677
@@ -76,7 +76,7 @@ anemone/utils/dict_of_numbered_dict_with_pointer_on_max.py,sha256=s5Z-O5mBwJUh4P
76
76
  anemone/utils/logger.py,sha256=bJQ8COqdn5obtbi8TuokQHmdHpp57XRksTmfvCLLfyM,2973
77
77
  anemone/utils/my_value_sorted_dict.py,sha256=LbqtpBSCS7VrUTUChWCsi18IKZj65FkTJREqbl-xSVA,619
78
78
  anemone/utils/small_tools.py,sha256=l9dy5Oqvuvg8qQXqJUfyb3uwBHwVGVrKz6WeTHjyLTk,2766
79
- algorhino_anemone-0.1.8.dist-info/METADATA,sha256=Wm0d3vz4THxZJdb0IBDUHo9zHhrnK87XJeWyM8UzXhk,5691
80
- algorhino_anemone-0.1.8.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
81
- algorhino_anemone-0.1.8.dist-info/top_level.txt,sha256=G1vbB-vAevQVde3UZ5X1_Ysy1_6sJDEueHRi2qcDgrY,8
82
- algorhino_anemone-0.1.8.dist-info/RECORD,,
79
+ algorhino_anemone-0.1.10.dist-info/METADATA,sha256=Z1k54ME5SXYqL4aFeYt4157f7ikwIZslHJS0eV6md58,5693
80
+ algorhino_anemone-0.1.10.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
81
+ algorhino_anemone-0.1.10.dist-info/top_level.txt,sha256=G1vbB-vAevQVde3UZ5X1_Ysy1_6sJDEueHRi2qcDgrY,8
82
+ algorhino_anemone-0.1.10.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.10.1)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
anemone/basics.py CHANGED
@@ -1,6 +1,23 @@
1
1
  """Basic types and protocols for Anemone."""
2
2
 
3
- from typing import Annotated
3
+ from typing import Annotated, Protocol
4
+
5
+ from valanga import Color, HasTurn, State
4
6
 
5
7
  type Seed = Annotated[int, "seed"]
6
8
  type TreeDepth = Annotated[int, "Depth level of a node in a tree structure"]
9
+
10
+
11
+ class StateWithTurn(State, HasTurn, Protocol):
12
+ """A `valanga.State` that also exposes turn information."""
13
+
14
+ ...
15
+
16
+
17
+ class HasBlackAndWhiteTurn(Protocol):
18
+ """Protocol for state that has black and white turns."""
19
+
20
+ @property
21
+ def turn(self) -> Color:
22
+ """Return the current player's turn color."""
23
+ ...
anemone/factory.py CHANGED
@@ -7,12 +7,7 @@ from queue import Queue
7
7
  from random import Random
8
8
  from typing import Literal, Type
9
9
 
10
- from valanga import (
11
- ContentRepresentation,
12
- RepresentationFactory,
13
- StateModifications,
14
- TurnState,
15
- )
10
+ from valanga import RepresentationFactory, StateModifications, TurnState
16
11
  from valanga.evaluator_types import EvaluatorInput
17
12
 
18
13
  from anemone import node_factory
@@ -63,7 +58,7 @@ def create_tree_and_value_branch_selector[StateT: TurnState](
63
58
  random_generator: Random,
64
59
  master_state_evaluator: MasterStateEvaluator,
65
60
  state_representation_factory: RepresentationFactory[
66
- StateT, ContentRepresentation[StateT, EvaluatorInput], StateModifications
61
+ StateT, EvaluatorInput, StateModifications
67
62
  ]
68
63
  | None,
69
64
  queue_progress_player: Queue[IsDataclass] | None,
@@ -95,7 +90,7 @@ def create_tree_and_value_branch_selector_with_tree_eval_factory[StateT: TurnSta
95
90
  random_generator: Random,
96
91
  master_state_evaluator: MasterStateEvaluator,
97
92
  state_representation_factory: RepresentationFactory[
98
- StateT, ContentRepresentation[StateT, EvaluatorInput], StateModifications
93
+ StateT, EvaluatorInput, StateModifications
99
94
  ]
100
95
  | None,
101
96
  node_tree_evaluation_factory: NodeTreeEvaluationFactory[StateT],
@@ -39,10 +39,7 @@ class AlgorithmNodeFactory[StateT: State = State]:
39
39
 
40
40
  tree_node_factory: TreeNodeFactory[AlgorithmNode[StateT], StateT]
41
41
  state_representation_factory: (
42
- RepresentationFactory[
43
- StateT, ContentRepresentation[StateT, EvaluatorInput], StateModifications
44
- ]
45
- | None
42
+ RepresentationFactory[StateT, EvaluatorInput, StateModifications] | None
46
43
  )
47
44
  node_tree_evaluation_factory: NodeTreeEvaluationFactory[StateT]
48
45
  exploration_index_data_create: node_indices.ExplorationIndexDataFactory[
@@ -44,7 +44,7 @@ class TreeAndValueBranchSelector[StateT: TurnState = TurnState]:
44
44
  recommend_branch_after_exploration: recommender_rule.AllRecommendFunctionsArgs
45
45
  queue_progress_player: Queue[IsDataclass] | None
46
46
 
47
- def select_branch(self, state: StateT, selection_seed: Seed) -> Recommendation:
47
+ def recommend(self, state: StateT, seed: Seed) -> Recommendation:
48
48
  """
49
49
  Selects the best branch based on the tree and value strategy.
50
50
 
@@ -56,7 +56,7 @@ class TreeAndValueBranchSelector[StateT: TurnState = TurnState]:
56
56
  - The recommended branch based on the tree and value strategy.
57
57
  """
58
58
  tree_exploration: TreeExploration = self.create_tree_exploration(state=state)
59
- self.random_generator.seed(selection_seed)
59
+ self.random_generator.seed(seed)
60
60
 
61
61
  branch_recommendation: Recommendation = tree_exploration.explore(
62
62
  random_generator=self.random_generator