This commit is contained in:
Sander Land committed 2020-12-07 13:50:50 +01:00
1 parent b3ee899ec4
commit 7d8cec3aed
23 files changed
+53 -44

No files matched your search

+6 -1
View File
@@ -502,6 +502,7 @@ class BadukPanWidget(Widget):
]
top_move_coords = None
child_moves = {c.move.gtp() for c in current_node.children if c.move}
if hint_moves:
low_visits_threshold = katrain.config("trainer/low_visits", 25)
top_moves_show = [
@@ -519,7 +520,11 @@ class BadukPanWidget(Widget):
scale = HINT_SCALE
text_on = True
alpha = HINTS_ALPHA
if move_dict["visits"] < low_visits_threshold and not engine_best_move:
if (
move_dict["visits"] < low_visits_threshold
and not engine_best_move
and not move_dict["move"] in child_moves
):
scale = UNCERTAIN_HINT_SCALE
text_on = False
alpha = HINTS_LO_ALPHA
+9 -7
View File
@@ -253,11 +253,10 @@ class NewGamePopup(QuickConfigGui):
def normalized_rules(self):
rules = self.katrain.game.root.get_property("RU", "japanese").strip().lower()
for abbr, name in self.katrain.engine.RULESETS_ABBR:
if abbr==rules or abbr==rules:
if abbr == rules or abbr == rules:
return name
def update_playerinfo(self,*args):
def update_playerinfo(self, *args):
for bw, player_setup in self.player_setup.players.items():
name = self.player_name[bw].text
if name:
@@ -274,7 +273,6 @@ class NewGamePopup(QuickConfigGui):
if rules is not None:
self.rules_spinner.select_key(rules.strip())
def update_config(self, save_to_file=True):
super().update_config(save_to_file=save_to_file)
self.katrain.log(f"New game settings: {self.katrain.config('game')}", OUTPUT_DEBUG)
@@ -288,11 +286,15 @@ class NewGamePopup(QuickConfigGui):
props = self.collect_properties(self)
root = self.katrain.game.root
changed = False
for k, currentval, newval in [("RU",self.normalized_rules(), props["game/rules"]), ("KM", root.komi, props["game/komi"])]:
if currentval !=newval:
for k, currentval, newval in [
("RU", self.normalized_rules(), props["game/rules"]),
("KM", root.komi, props["game/komi"]),
]:
if currentval != newval:
changed = True
self.katrain.log(
f"Property {k} changed from {currentval} to {newval}, triggering re-analysis of entire game.", OUTPUT_INFO
f"Property {k} changed from {currentval} to {newval}, triggering re-analysis of entire game.",
OUTPUT_INFO,
)
self.katrain.game.root.set_property(k, newval)
self.update_playerinfo()
+2 -2
View File
@@ -143,8 +143,8 @@ class MoveTreeCanvas(Widget):
def children_with_shortcuts(move):
shortcuts = move.shortcuts_to
via = [v for m, v in shortcuts] # children that are shortcut
return [m for m in move.ordered_children if m not in via] + [m for m, v in shortcuts]
via = {v: m for m, v in shortcuts} # children that are shortcut
return [m if m not in via else via[m] for m in move.ordered_children]
self.move_pos = {root: (0, 0)}
stack = children_with_shortcuts(root)[::-1]