diff --git a/src/draw_goban.js b/src/draw_goban.js index 586501e..7bc1e29 100644 --- a/src/draw_goban.js +++ b/src/draw_goban.js @@ -733,6 +733,7 @@ function draw_branches(h, xy, radius, g) { // ref. https://github.com/featurecat/lizzie/issues/671#issuecomment-586090067 function draw_loss(h, xy, radius, g) { + draw_low_policy(h, xy, radius, g) const {gain, punished} = h, NOTHING = [] const [color, size, draw, min_width] = !truep(gain) ? NOTHING : (gain <= big_blunder_threshold) ? [RED, 1, rev_triangle_around, 0.7] : @@ -746,6 +747,17 @@ function draw_loss(h, xy, radius, g) { draw(xy, radius * size - line_width, g) } +function draw_low_policy(h, xy, radius, g) { + const very_low_policy = 0.01, low_policy = 0.1, very_high_policy = 0.7 + const {policy, max_policy} = h; if (!max_policy) {return} + const draw = (line_width) => { + g.strokeStyle = '#888'; g.lineWidth = line_width + square_around(xy, radius * 0.7 - line_width, g) + } + max_policy > very_high_policy && policy < low_policy ? draw(3) : + policy < very_low_policy ? draw(1) : null +} + function draw_shadow_maybe(h, xy, radius, cheap_shadow_p, g) { if (!h.stone) {return} const {stone_image, style} = stone_style_for(h) diff --git a/src/powered_goban.js b/src/powered_goban.js index 1c91749..6c3ee11 100644 --- a/src/powered_goban.js +++ b/src/powered_goban.js @@ -461,6 +461,10 @@ function winrate_from_game(engine_id) { merge(cur, {gain}) s <= game.move_count && merge_to_stone_at(cur, {gain}) record_punished(gain) + const {suggest} = prev; if (!suggest) {return} + const max_policy = Math.max(...suggest.map(h => h.prior)) + const policy = (suggest.find(h => h.move === cur.move) || {}).prior || 0.0 + merge_to_stone_at(cur, {policy, max_policy}) } const record_punished = gain => { const prev_gain = (prev || {}).gain diff --git a/src/util.js b/src/util.js index f7702de..ceff242 100644 --- a/src/util.js +++ b/src/util.js @@ -56,6 +56,9 @@ E.handicap_komi = -0.5 E.default_gorule = 'chinese' E.blunder_threshold = -2 E.big_blunder_threshold = -5 +E.blunder_very_low_policy = 0.01 +E.blunder_low_policy = 0.1 +E.blunder_high_policy = 0.7 E.black_to_play_p = (forced, bturn) => forced ? (forced === 'black') : bturn // seq(3) = [ 0, 1, 2 ], seq(3, 5) = [ 5, 6, 7 ], seq(-2) = []