pv stabilization, fav child

This commit is contained in:
Sander Land committed 2020-05-13 20:14:53 +02:00
1 parent 23f8cc97ca
commit 872de528d9
8 files changed
+58 -38

No files matched your search

+11
View File
@@ -18,6 +18,7 @@ class GameNode(SGFNode):
self.ai_thoughts = ""
self.move_number = 0
self.undo_threshold = random.random() # for fractional undos, store the random threshold in the move itself for consistency
self._favourite_child = None
def sgf_properties(self, save_comments_player=None, save_comments_class=None, eval_thresholds=None):
properties = copy.copy(super().sgf_properties())
@@ -48,6 +49,16 @@ class GameNode(SGFNode):
def order_children(children):
return sorted(children, key=lambda c: 0.5 if c.auto_undo is None else int(c.auto_undo)) # analyzed/not undone main, non-teach second, undone last
def set_favourite_child(self, c):
self._favourite_child = c
@property
def favourite_child(self) -> Optional["GameNode"]:
if self._favourite_child:
return self._favourite_child
elif self.children:
return self.children[0]
# various analysis functions
def analyze(self, engine, priority=0, visits=None, time_limit=True, refine_move=None, analyze_fast=False):
engine.request_analysis(