This commit is contained in:
Sander Land committed 2020-09-11 20:57:11 +02:00
1 parent 71bf90c992
commit 4f24e2e9b1
2 files changed
+37 -9

No files matched your search

+33 -8
View File
@@ -409,14 +409,25 @@ class BadukPanWidget(Widget):
self.active_pv_moves = [] self.active_pv_moves = []
# hints or PV # hints or PV
hint_moves = []
if ( if (
katrain.analysis_controls.hints.active katrain.analysis_controls.hints.active
and not katrain.analysis_controls.policy.active and not katrain.analysis_controls.policy.active
and not game_ended and not game_ended
): ):
hint_moves = current_node.candidate_moves hint_moves = current_node.candidate_moves
low_visits_threshold = katrain.config("trainer/low_visits",25) elif katrain.controls.status_state[1] == STATUS_TEACHING: # show score hint for teaching undo
for i, move_dict in enumerate(hint_moves): hint_moves = [
m
for m in current_node.candidate_moves
for c in current_node.children
if c.move and c.auto_undo and c.move.gtp() == m["move"]
]
top_move_coords = None
if hint_moves:
low_visits_threshold = katrain.config("trainer/low_visits", 25)
for move_dict in hint_moves:
move = Move.from_gtp(move_dict["move"]) move = Move.from_gtp(move_dict["move"])
if move.coords is not None: if move.coords is not None:
scale = HINT_SCALE scale = HINT_SCALE
@@ -438,7 +449,7 @@ class BadukPanWidget(Widget):
Rectangle( Rectangle(
pos=(self.gridpos_x[move.coords[0]] - evalsize, self.gridpos_y[move.coords[1]] - evalsize), pos=(self.gridpos_x[move.coords[0]] - evalsize, self.gridpos_y[move.coords[1]] - evalsize),
size=(2 * evalsize, 2 * evalsize), size=(2 * evalsize, 2 * evalsize),
source="katrain/img/topmove.png", source="img/topmove.png",
) )
if self.trainer_config["text_point_loss"] and text_on: if self.trainer_config["text_point_loss"] and text_on:
if move_dict["pointsLost"] < 0.05: if move_dict["pointsLost"] < 0.05:
@@ -454,19 +465,19 @@ class BadukPanWidget(Widget):
font_name="Roboto", font_name="Roboto",
) )
if i == 0: if move_dict.get("order", 99) == 0:
top_move_coords = move.coords
Color(*TOP_MOVE_BORDER_COLOR) Color(*TOP_MOVE_BORDER_COLOR)
Line( Line(
circle=( circle=(
self.gridpos_x[move.coords[0]], self.gridpos_x[move.coords[0]],
self.gridpos_y[move.coords[1]], self.gridpos_y[move.coords[1]],
self.stone_size * scale - 1.2, self.stone_size - dp(1.2),
), ),
width=dp(1.2), width=dp(1.2),
) )
# children of current moves in undo / review # children of current moves in undo / review
alpha = POLICY_ALPHA
if katrain.analysis_controls.show_children.active: if katrain.analysis_controls.show_children.active:
for child_node in current_node.children: for child_node in current_node.children:
points_lost = child_node.points_lost points_lost = child_node.points_lost
@@ -476,15 +487,29 @@ class BadukPanWidget(Widget):
self.active_pv_moves.append( self.active_pv_moves.append(
(move.coords, [move.gtp()] + child_node.candidate_moves[0]["pv"], current_node) (move.coords, [move.gtp()] + child_node.candidate_moves[0]["pv"], current_node)
) )
if move.coords != top_move_coords: # for contrast
dashed_width = 18
Color(*STONE_CONTRAST_COLORS[child_node.player])
Line(
circle=(
self.gridpos_x[move.coords[0]],
self.gridpos_y[move.coords[1]],
self.stone_size - dp(1.2),
),
width=dp(1.2),
)
else:
dashed_width = 10
Color(*STONE_COLORS[child_node.player]) Color(*STONE_COLORS[child_node.player])
for s in range(0, 360, 30): for s in range(0, 360, 30):
Line( Line(
circle=( circle=(
self.gridpos_x[move.coords[0]], self.gridpos_x[move.coords[0]],
self.gridpos_y[move.coords[1]], self.gridpos_y[move.coords[1]],
self.stone_size - 1.2, self.stone_size - dp(1.2),
s, s,
s + 12, s + dashed_width,
), ),
width=dp(1.2), width=dp(1.2),
) )
+4 -1
View File
@@ -8,6 +8,8 @@ DEFAULT_FONT = "fonts/NotoSansCJKsc-Regular.otf"
WHITE = [0.95, 0.95, 0.95, 1] WHITE = [0.95, 0.95, 0.95, 1]
BLACK = [0.05, 0.05, 0.05, 1] BLACK = [0.05, 0.05, 0.05, 1]
LIGHTGREY = [0.7, 0.7, 0.7, 1] LIGHTGREY = [0.7, 0.7, 0.7, 1]
GREY = [0.5, 0.5, 0.5, 1]
LIGHTERGREY = [0.85, 0.85, 0.85, 1]
RED = [0.8, 0.1, 0.1, 1] RED = [0.8, 0.1, 0.1, 1]
GREEN = [0.1, 0.8, 0.1, 1] GREEN = [0.1, 0.8, 0.1, 1]
@@ -50,6 +52,7 @@ EVAL_DOT_MAX_SIZE = 0.5
EVAL_DOT_MIN_SIZE = 0.25 EVAL_DOT_MIN_SIZE = 0.25
STONE_COLORS = {"B": BLACK, "W": WHITE} STONE_COLORS = {"B": BLACK, "W": WHITE}
STONE_CONTRAST_COLORS = {"B": LIGHTERGREY, "W": GREY}
OUTLINE_COLORS = {"B": [0.3, 0.3, 0.3, 0.5], "W": [0.7, 0.7, 0.7, 0.5]} OUTLINE_COLORS = {"B": [0.3, 0.3, 0.3, 0.5], "W": [0.7, 0.7, 0.7, 0.5]}
STONE_TEXT_COLORS = {"W": BLACK, "B": WHITE} STONE_TEXT_COLORS = {"W": BLACK, "B": WHITE}
@@ -60,7 +63,7 @@ STARPOINT_SIZE = 0.1
BOARD_COLOR = [0.85, 0.68, 0.40, 1] BOARD_COLOR = [0.85, 0.68, 0.40, 1]
STONE_SIZE = 0.505 # texture edge is transparent STONE_SIZE = 0.505 # texture edge is transparent
HINTS_MIN_ALPHA = 0.2 # single visit HINTS_MIN_ALPHA = 0.2 # single visit
HINTS_ALPHA = 0.8 HINTS_ALPHA = 0.8
POLICY_ALPHA = 0.6 POLICY_ALPHA = 0.6
TOP_POLICY_ALPHA = 0.3 TOP_POLICY_ALPHA = 0.3