kaorahi / lizgoban

Leela Zero & KataGo visualizer
GNU General Public License v3.0
169 stars 28 forks source link

Is it possible to set the last move to still be displayed as a number in Face Stone mode? #95

Closed qcgm1978 closed 11 months ago

qcgm1978 commented 11 months ago

When using stone as face, all the pieces on the board are displayed as emojis, which can cause the last move to be confused with other pieces, making it difficult to see where the last move was made. For example, the following changes could be made:

function draw_stone(h, xy, radius, draw_last_p, draw_loss_p, g) {
    ...
    if (draw_last_p && h.last && h.move_count > R.init_len) {
        draw_last_move(h, xy, radius, g)
        draw_stone_by_gradation() 
        draw_movenums(h, xy, radius, g)
    } else {
        stone_image ? draw_stone_by_image() :
            style === '3D' ? draw_stone_by_gradation() : draw_stone_by_paint()

        h.movenums &&
            draw_movenums(h, xy, radius, g)
    }
}
function draw_movenums(h, xy, radius, g) {
    const num = h.movenums || [h.anytime_stones[0].move_count];
    movenums = num_sort(num), mn0 = movenums[0], mc = mn0 - 1
    ...
}

https://github.com/kaorahi/lizgoban/assets/3024299/684d1572-e227-49c7-8aa0-79ef98624313

kaorahi commented 11 months ago

Hmm... In the official version, each stone has its own facial expression based on the ownership. So, losing this feature on the last stone is unfortunate.

We already have the last stone marker, a black or white circle around the last facial stone, but it will be unnoticeable on your stone emoji. How about making it more prominent? This is a crude example.

--- a/src/draw_goban.js
+++ b/src/draw_goban.js
@@ -625,11 +625,12 @@ function draw_stone(h, xy, radius, draw_last_p, draw_loss_p, g) {
         g.fillStyle = h.black ? b_color : w_color
         with_gray_stone(edged_fill_circle, xy, radius, g)
     }
+    // draw last stone mark BEHIND the stone
+    draw_last_p && h.last && h.move_count > R.init_len &&
+        draw_last_move(h, xy, radius, g)
     stone_image ? draw_stone_by_image() :
         style === '3D' ? draw_stone_by_gradation() : draw_stone_by_paint()
     draw_loss_p && !hide_loss_p && draw_loss(h, xy, radius, g)
-    draw_last_p && h.last && h.move_count > R.init_len &&
-        draw_last_move(h, xy, radius, g)
     h.movenums && draw_movenums(h, xy, radius, g)
 }

@@ -706,8 +707,8 @@ function draw_text_on_stone(text, color, xy, radius, g) {
 function draw_last_move(h, xy, radius, g) {
     const facep = face_image_p() && !h.movenums
     const bturn = xor(h.black, facep), size = facep ? 1 : 0.8
-    g.strokeStyle = bturn ? WHITE : BLACK; g.lineWidth = 2
-    circle(xy, radius * size, g)
+    g.strokeStyle = bturn ? '#f0f' : '#0f0'; g.lineWidth = 8
+    square_around(xy, radius * size, g)
 }

 const next_move_line_width = 3, branch_line_width = next_move_line_width

I'm not sure what mark is nice for wide variety of stone images. It must be visible, but it shouldn't be too "loud".

qcgm1978 commented 11 months ago

I tried it, and it is an interesting solution. However, I would prefer to see the number of moves that have been made in the game. If it is marked as a number, there is no need to adjust the style. However, this is a personal preference.