Having bots play in Japanese rules?

Question - is there a way to potentially run a bot supporting Japanese rules on OGS?

Before too long I expect to have some versions of KataGo (currently running as kata-bot on this server) that experimentally support Japanese rules… or at least something close enough that in all but highly rare and exceptional cases it will match Japanese rules. (So, no superko, scoring based on territory+captures, bent-4-in-the-corner is dead even if there are ko threats in a seki elsewhere, etc). Of course, it’s possible the bot would misevaluate one of these rare cases, but that would be its own mistake, no different than any other mistake that a bot could make in normal play.

As far as the bot’s behavior, it would be what you’d expect - playing the game normally, finishing up the borders, (usually) filling all the dame, and then passing (without physically capturing stones believed to be dead).

Would there be a way to potentially run such a bot on OGS? I don’t see a way to specify rules for the current gtp interface. But OGS seems to have a pretty good dead-stone heuristic algorithm, so it seems likely to me that OGS’s automatic scoring could be good enough most of the time to not even need any API for agreeing on dead groups and such, so the current API might already be enough, if only there was some flag to set the rules.

1 Like

Bot games have to use OGS auto-scoring for scoring (because there isn’t a way to do the stone removal phase with bots).

OGS auto-scoring is Chinese only.

So I think the answer is “no, not as it stands”.

1 Like

Does the auto-scoring really only work for Chinese only? It seems to me that if the auto-scoring was reasonably accurate, Japanese scoring with ‘stone removal’ for all the stones the auto-scoring believes are dead would be good enough?

Or maybe the problem is that in the rare cases where the auto-scoring is in error, there’s no way to “help” correct it via an additional move without losing points?

The auto-scorer is in fact “reasonably accurate”, but also “substantially flawed in some situations”.

This gives rise to games with bots that have to be annulled when it gets it wrong: these are not frequent, but they are regular.

I’m not across the reason why Chinese is easier for programs than Japanese, but it appears to be the case, and is given as the reason why score estimators do Chinese.

There is hope on the horizon for better with AI help.

2 Likes

I think the reason that the autoscore may work better on the chinese ruleset is that in chinese rules, its adventageous to fill in Dame. When all Dame are filled, this leavs far less variations on the board. And indeed, when the bot removes dead stones, you dont lose a point removing those stones… (But you do loe a turn).

If that is the case then it would make the game easier to “Score/read” to get an accurate answer.

Not that i am an expert, but this does seem to be the most simple solution as to why chinese rules may be prefered.

Probably it’s Seki, but I’m not a computer go expert. In Japanese rules, eyes of Groups in Seki don’t count, so additionally to assess live/death of groups, the computer has to find out which groups are in Seki.

1 Like

I think seki is just one complication out of many that arise from the potential complexities of determining life and death under Japanese rules.

Under Chinese and other area scoring rules, it’s possible to further simplify the endgame position by playing on to capture strategically dead stones (indeed, this is method to resolve disputes and requires no advanced reading skills on the part of the arbiter). This is possible, since these additional plays won’t change the final score.

On the other hand, with Japanese rules, play is often strategically forced to end with some stones left uncaptured, and requires the arbiter to work through all of the complexities of life and death with careful reading (possibly assisted by the players). Further, there are some nuances and weird situations that only seem to arise in the Japanese rules:

  1. Determining life and death in the confirmation phase (after both players have passed) considers hypothetical perfect play with a different ko rule than is normally used during the rest of the game. It’s possible for stones to not be killable or saveable during normal play, but only die during the confirmation phase.
  2. It’s possible for both players to lose if they make the mistake of leaving a decisive, unsettled position on the board.
  3. It’s possible to have stones that are declared dead during confirmation but not removed for counting the score, in the case of anti-seki.
  4. The case of Moonshine Life seems to lead to a possible endless loop during the confirmation phase. However, the Japanese rules clarify and provide a special ruling for this particular pattern in the official commentary.

While these issues are quite rare, their possible existence means that any software needs to be ready to handle some difficult edge cases, makes developing a solid algorithmic approach to life and death under Japanese rules quite challenging.

4 Likes

And if I should ever attempt to write a go program I’ll translate this to: ‘absolutely not worth the trouble’

2 Likes

The KataGo bot author put together a web-page that presents “a rigorous nearly-Japanese-rules that bots can use”

https://lightvector.github.io/KataGo/rules.html

Click on the “Japaneselike Rules” button and then scroll down to see the complexity required and compare to what is needed for “Chineselike” or “Tromp-Taylor” rules.

3 Likes

KataGo’s author also started a discussion on those rules here: https://lifein19x19.com/viewtopic.php?f=45&t=17089

3 Likes

The discussion at Life in 19x19 seems pretty much concluded, and I think I’m happy with the result, which I’ve just pushed to the same link (https://lightvector.github.io/KataGo/rules.html) as a revised version. The revisions handle a few very, very rare corner cases a little better, but all common cases continue to work correctly and unchanged.

As best I can tell, these rules should work great for computer matches or self-play training. They’re not actually that complex or hard to implement (so long as you leave out the SelfPlayOpts). The hard part by far was formulating them. But now that that’s done, implementing them I actually found to be easier than bug-freely implementing Chess rules - between en-passant, castling state, and 50 move counter, and disallowing moves that expose self to check, and different piece movements.

If OGS wished to support Japanese rules bots, I suspect it would actually be not too arduous. And it would also not even need rules like these (which are designed for bot play, not humans). For example one method would be:

  • Unrated games only.
  • Make gtp2ogs support a single GTP extension for a bot to specify a list of coordinates of stones that it believes are dead, and add a single API call that gtp2ogs can feed this to.
  • This would hook into the exact same mechanism that players already use to mark dead stones in human games.
  • Optional either way: players would not be allowed to “disagree” with the bot’s marking… OR alternatively, players would be allowed to freely override the bot’s marking.

In case of disputes, since the game is unrated, there is nothing at stake, and nothing serious to gain by abuse regardless of the choice of the last option. And it should be very, very rare that a well-trained bot should have the wrong result. This is very similar to how KGS successfully supports Japanese-rules bots.

4 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.