Open trdischat opened 1 month ago
This is really cool. I will test it later but assuming it all works it seems like an awesome change. You have inspired me to include a similar feature for my chess template.
So playing around with it it seems to work well, though I had to change let answer in goodAnswers
to let answer of goodAnswers
. I have included the tracking of incorrect solution as its a nice feature to have. My implementation simplifies this a bit by just checking for "INCORRECT", "WRONG", "FAIL", and assuming the line as correct otherwise. I also don't consider children as I feel this is unnecessary and allows you to be more flexible with your comments. Seems unnecessary to specify a move as correct but let me know if you have a specific use case for it. I am about to push an update that includes checking of wrong answers as well as a your other suggestions and a few fixes.
Specifying correct versus incorrect moves in SGF has always been a bit of a challenge. Each software program adopts a slightly different approach. I summarized the state of affairs a few years ago (in a post on lifein19x19) as follows:
I use Drago to edit problems and EasyGo to practice problems on my iPhone.
Based on my review of many published problems in books, it seemed to me that the main line is generally the correct answer, but that alternate lines often present incorrect answers. As I thought about it, it struck me that a correct answer is typically a line where the player (i.e., the first to play) plays the last move in the sequence. If the computer plays the last move, that should signify that the sequence is an incorrect answer. So it seemed best to me to let the drafter of the problem explicitly designate in the node comment (or other node property) to the last move in a line of play whether that sequence is correct or incorrect. But if there is nothing in the comments (or other SGF properties) to tell you whether a line of play is correct or incorrect, the final bit of logic would be to mark it as correct if the color of the last move matches the color of the first move, and mark it as incorrect if the colors of the first and last moves are different.
Of course, joseki practice is different, since most lines of play are correct, and each line could end with either black or white. But I hadn't worked out an approach for this yet. I view joseki as a programming challenge for another day.
Yeah ok, that's interesting. Are you able to explain what SGF property of BM[2] means? With your code tracking these alternatives should be possible. I'm not a fan of trying to accommodate them all by default, but having a variable that can be set to determine how the template handles all of this seems like a good option to have.
In standard SGF, BM[2] means very bad move, while TE[2] means very good move (i.e., tesuji). See https://www.red-bean.com/sgf/properties.html#BM. I don't see much value in covering these use cases, as almost nobody uses them for problems. These codes are really meant for commentary on moves in a complete game record.
@TowelSniffer, I made another improvement to the templates that you might find interesting. The current template assumes that all lines of play in the problem are correct solutions. As long as you only click on moves in the tree, the template shows a green border on the back side of the card. The problem with this is that many go problems present incorrect lines of play so that they can explain why they are bad moves. I wanted to identify this in the template so that a green border will only display if you only click on a line of play AND the line of play is an actual correct answer. The logic I had in mind was this:
If the current node has no children (i.e., it is the end of a line of play):
I wrote the following code to implement this idea (apologies for the lengthy explanation).
update
function inbesogo.makeControlPanel
in the FRONT template as follows:navigate
function inbesogo.makeEditor
in the FRONT template as follows:firstMoveBlank
flag (it is replaced by thefirst2move
flag) from theloadSGF
method in both FRONT AND BACK templates:loadProp
function in both FRONT AND BACK templates to read as follows: