Score Estimate vs Result

Thanks for finding this case! I pushed a change to Territory Scoring Test that should fix it.

It’s very much cases like the one that you found that I’m concerned with getting to behave intuitively as much as possible, rather than the more bizarre cases that people would consider “rules beasts” such as all the weird examples in the Japanese official rules commentary. I find the “weird” cases are often easy to handle algorithmically precisely because we can assume life and death is marked for us. It’s the ones where the position is incomplete, or not all the dame are filled, and/or where one has to make a judgment call as to how much work the algorithm tries to do in those cases versus leaving it to the players, that it becomes much harder.

Anyways, you can see the new behavior here in the screenshot:

The case you found with a straight 6 being filled with a straight 4 marked dead (also the upper right corner in the screenshot), is an interesting one because black does actually owe a move! Two moves, even. Unless black actually captures the “dead” stones before the dame are filled, the position will become a seki, so black’s final territory should be two points smaller than it would if we simply just counted the region as territory. But if it’s not played out, and the stones are marked dead, given the choice between scoring it as territory and not scoring it, scoring it is clearly the more intuitive choice, and it would be up to white to fill the dame before the end of the game to force black to make the 2 additional moves.

There are cases where two stones can be captured without disturbing a seki and where the player has no ability to fill dame to force the opponent to make the capture, and if you relax the requirement that all the fillable dame are filled you can construct where more stones can be captured without disturbing a seki (but the ones I can find, filling the dame will force things along and/or the players actually want do to continue play rather than stop).

I kind of also want to make the scoring algorithm “AI-resistant”, in the sense that if there are sekis where there are “dead” stones that are freely capturable, then even though under Japanese rules technically those stones should be marked as alive (Japanese rules to my understanding require you to physically capture such stones in sekis before ending play to gain those points), in practice I would expect many sources of automated marking such as from AIs would mark them as dead in the expectation that they will be captured even if the players don’t actually do so. This means that it’s desirable for the scoring algorithm to avoid counting territory in those cases of technically-wrong marks.

Due to general nervousness about such cases, for now I adjusted it to only count territory in these cases when it thinks the capture of the marked dead stones would leave a living shape.

Let me know if you find any more weird cases, it’s really helpful.

4 Likes