# In Go (board game) under Chinese rulings how does the scoring of empty territory work?

I am reading up on the Chinese rules of Go and have trouble understanding the ‘area scoring’ rules they use.

I get that each player gets a point for each stone that is alive, for each empty field in their territory and for each empty field in neither territory, but how exactly is any of this figured out? As far as I understand it, after a game both players agree on which stones are dead and which empty positions count towards which player's territory. This doesn't seem very satisfying.

If I were to write a computer program that is supposed to score a given board state at the end of the game, how would such a machine make these decisions? It can't, can it?

I can see how this would work in case of eyes, as there is no way of placing an opponent's stone there, but for everything bigger then that it seems obscure to me how that decision (black, white, neutral territory) is made.

• Where did you get the impression that each empty field in neither territory gives a point? Since they would cancel out anyway it would make no difference, but it is not in the area scoring rules they use. May 10, 2018 at 14:08
• @PJTraill here in Section 7 determining the winner May 10, 2018 at 15:31
• I see – but it is Section 9, and says “Vacant points situated between both sides' living stones are shared equally”, meaning they get half each. But what it actually says is that you only count the score for one player, and compare that with 180½, so the reason for counting them although they cancel is to be able to compare with 180½. But your question is of course actually about how one recognises dead stones and surrounded territory, and has been adequately answered: if one cannot agree, play it out; see also Chapter 3. Section 21. The end of the game (with some unclear points!). May 12, 2018 at 19:54
• Note also that the rules you linked to do not only define the score but specify a specific method of counting it; Sensei’s Library, to which I linked, gives a definition, and describes the Chinese method in a separate article, Chinese Counting; see also Counting methods. May 12, 2018 at 20:11

It's already clear for you that a group with two eyes is alive.

By extension, a group that has enough room for two eyes is alive, even if the eyes are not formed.

At the end of the game, the human players would indicate - by a click for example - which stones are dead. The computer can then do the scoring.

If you expect the computer to figure out which stones are dead, then it needs to know how to play. There is now open source software that can do it, such as Leela Zero.

• But what if there is room for two eyes and a potential invasion of the opponent that can at least create a seki (I think that's the name)? If both play sub-optimal enough this situation might arise. Also how would one deal with scoring weird "edge cases", e.g. two players make one move and then both decide the game is over? May 10, 2018 at 7:41
• If one player thinks an invasion may succeed, they need to try that invasion before passing at the end of the game. If both players agree the game is over after one move, then the whole board is a seki - there are no points surrounded by white or black stones.
– TimK
May 10, 2018 at 11:29
• Same as any game really, if there's a winning sequence and the player doesn't see it then it's moo. That's why the standard sequence on online go sites is to ask the players to mark dead stones (try OGS for example). In chess, you could have a case where the software predicts checkmate in 5 moves but the player never sees the sequence. May 10, 2018 at 14:45
• Just to give you an example, a heated discussion on the status of a corner territory: forums.online-go.com/t/question-on-3-3-invasion/15523 . Go was chosen as experimental field for AI for a reason! May 10, 2018 at 14:54
• @TimK do I understand that right? If the game ends and both parties disagree on who's territory it is then that region is seki? (Surrounding is relative, there is this joke with the mathematician catching a lion...) May 10, 2018 at 15:38

First remove all dead groups. Remember, groups are only dead by player agreement, therefore a computer cannot possibly perform this step independent of the players.

Once the dead groups are removed the algorithm for scoring empty intersections is as follows: For each empty intersection. If all possible paths along the lines run into white stones, the intersection is scored for white, if they all run into black stones then it is scored for black. Otherwise it has no score.

QED

For actual computer programmers: Use Dijkstra's Algorithm where each intersection is a node and each line is an edge. If a search for a white stone fails from that intersection, then it is scored for black. If a search for a black stone fails, it is scored for white. If both succeed, then it is not scored. (Note that the only way the search could fail for both is if the board is empty.)

• This makes sense. Arguably the opponent could have continued playing if they thought that an invasion in an area might succeed. Algorithm wise flood-fill on "empty intersection" is the better option I think. That way you get the entire connected region and can decide who's territory it is based on the total number (and type) of colors encountered along the border. May 12, 2018 at 15:30
• In Wikipedia it says Dijkstra’s algorithm is for determining the shortest path between two nodes: is that what you meant? I suppose the idea in common is recursively checking all neighbours until you have your answer (though it may be implemented with a queue rather than recursively). May 12, 2018 at 20:02
• It can also be used to determine if there is a path between two nodes. Basically, the algorithm checks the 4 adjacent points, then the points adjacent to those points, etc. If a white stone, for e.g., can't be reached then that intersection can't possibly count toward white's score. May 12, 2018 at 20:13
• It's more "flood-fill" than "Dijkstra's", because (1) we're not interested in actually finding a shortest path; (2) if an intersection belongs to a player, then all intersections in the same territory also belong to the same player, so we don't need to look for a path from those intersections.
– Stef
Mar 21, 2022 at 16:03