artasparks / glift

Go Lightweight Frontend
MIT License
115 stars 33 forks source link

Ladder problems cannot have their middle part automated #163

Open sartak opened 8 years ago

sartak commented 8 years ago

Glift's "standard problem" widget either gets confused about whose turn it is, or doesn't cope gracefully with AW/AB nodes appearing in the middle of a tree. For example in the following problem, you start as black but then after the AW/AB bits, your next move is played as white(!) and the problem automatically plays black's moves against you.

(The following SGF, incidentally, would be the ideal formulation of the problem in my opinion, as it would mean white's move, after the ladder plays itself out, is highlighted for you to respond to)

(;GM[1]FF[4]SZ[19]
AB[lh:mh][en:eo][fn][fp:gp]
AW[kh][mi][fo:go]
C[Black to play. Tenuki at T if the ladder is favorable for White.]LB[dd:T]
;B[ho];W[gn];B[gm];
AW[jk:jl][kk][il:im][hm:hn]
AB[jj][ik][lk][hl][kl][jm][in];
W[kj];B[ki];W[lj];B[mj];W[li];B[ni]C[Correct.])

I tried several variations on this, but I couldn't make a legitimate ladder problem with Glift. I certainly don't want to play each move by hand! 😁

For example, when white is the last one to play before the AW/AB nodes, as follows, then Glift doesn't add any of the AW/AB stones. It then marks any move by black as incorrect:

(;GM[1]FF[4]SZ[19]
AB[lh:mh][en:eo][fn][fp:gp]
AW[kh][mi][fo:go]
C[Black to play. Tenuki at T if the ladder is favorable for White.]LB[dd:T]
;B[ho];W[gn];B[gm];W[hn];
AW[kj:kk][jk:jl][il:im][hm]
AB[jj][ik][lk][hl][kl][jm][in];
B[ki];W[lj];B[mj];W[li];B[ni]C[Correct.])

If White passes immediately preceding the AW/AB, then Glift again doesn't add the AW/AB stones, and it's black's turn again, but anything you play is marked incorrect. (Even the correct move at B[ki], though you'd be hard pressed to find that given that the AW/AB stones hadn't been added)

(;GM[1]FF[4]SZ[19]
AB[lh:mh][en:eo][fn][fp:gp]
AW[kh][mi][fo:go]
C[Black to play. Tenuki at T if the ladder is favorable for White.]LB[dd:T]
;B[ho];W[gn];B[gm];W[];
AW[kj:kk][jk:jl][il:im][hm:hn]
AB[jj][ik][lk][hl][kl][jm][in];
B[ki];W[lj];B[mj];W[li];B[ni]C[Correct.])

If it's black's move immediately preceding and following the AW/AB, you still play as white after the middle of the ladder. Which on one hand is understandable because I'm sure Glift is alternating whose turn it is. But on the other, it's not what's in the SGF.

(;GM[1]FF[4]SZ[19]
AB[lh:mh][en:eo][fn][fp:gp]
AW[kh][mi][fo:go]
C[Black to play. Tenuki at T if the ladder is favorable for White.]LB[dd:T]
;B[ho];W[gn];B[gm];
AW[kj:kk][jk:jl][il:im][hm:hn]
AB[jj][ik][lk][hl][kl][jm][in];
B[ki];W[lj];B[mj];W[li];B[ni]C[Correct.])

So I can't make it work. While I expect some improvements could be made to Glift's handling of AW/AB, any ideas for what I could use in the meantime?