A lot of people in the West are first exposed to Go with the Japanese ruleset. However, it’s a bit of a mess, with several patches, and worse, some books seem to try to hide the complexity. Go is a complex game as-is, but the rules don’t need to be, the complexity is an emergent property that makes it fun. If you are comfortable with first year undergrad math and want to know a well-defined set of rules, keep reading. We will be discussing the Tromp-Taylor ruleset, which is perhaps the most elegant and short of them all. But don’t worry, Go with Tromp-Taylor is Go, and in practice any ruleset yields the same result in almost every case. This is not a fringe thing to learn, it’s just the simplest.

Disclaimer: strictly speaking, the following rules are a generalization of Tromp-Taylor rules to NN players and arbitrary finite, undirected graphs. However, I’m otherwise deviating from those rules as little as possible. I think part of the beauty of this game can only be appreciated if you see it generalized.

Go IRL

It’s a two-player board game played by turns with black and white stones. The most common and important board size is 19x19. The goal is (roughly) to enclose more territory than the other player, and on each turn the player may put a stone at any place on the board, provided that the spot is not already occupied by another stone (with some other restrictions we’ll get to later). Players may not move stones unless they need to be removed (because they are dead).

In this post we’ll be making heavy use of a 9x9 board for the examples, but in the end we’ll see other, more interesting graphs.

Math definitions

Board, game, points

Go is played on a finite, undirected graph

G=(V,E)G = (V, E)

where VV is the set of vertices/nodes and EE is the set of edges between them.

Nodes on the graph can be colored/labeled. For NN players, let the set of colors be:

C={0,c1,,cN}\mathcal C = \{\mathsf 0, c_1, \ldots, c_N\}

For the special case of two players I shall use:

C={0,B,W}\mathcal C = \{\mathsf 0, \mathsf{B}, \mathsf{W}\}

(I will also call them Empty, Black, and White; and I’ll use lowercase c for a specific color)(\text {I will also call them Empty, Black, and White; and I'll use lowercase } c \text{ for a specific color)}

A coloring of the board is a function:1

λ:VC\lambda: V \to \mathcal C

A point is just a vertex vVv \in V and its color is λ(v)\lambda(v).

A stone is a non-empty point. We’ll say things like “placing a stone at point P” as a shorthand of “coloring an empty point PP as λ(P)=c0\lambda(P) = c \neq \mathsf 0

Since the graph doesn’t change during the game, we can say that a game played for nn turns is a sequence of colorings:

(λi)=λ0,...,λn(\lambda_i)=\lambda_0, ..., \lambda_n

(where λ0\lambda_0 is the coloring before any player has done anything)

One immediate consequence of the above in typical go boards is that stones placed diagonally from each other are not adjacent:

Example 1
Go board diagram
AA is adjacent (touching) BB, CC, DD and EE, but not FF nor GG.

Reaching

A point P0P_0 with color c0c_0 is said to reach color c1c0c_1 \neq c_0 if and only if there exists a path of points of color c0c_0 that ends adjacent to a point of color c1c_1. That is, P0P_0 reaches c1c_1 if and only if:

 a path (P0,,Pm),QV\exists \text{ a path } (P_0, \ldots, P_m), \exists Q \in V

such that:

λ(Pi)=c0(i=0,,m),λ(Q)=c1,{Pm,Q}E \lambda(P_i)=c_0 \: (i=0,\ldots,m),\quad \lambda(Q)= c_1, \quad \left\{P_m,Q\right\} \in E

(The last bit means that PmP_m and QQ are adjacent because there exists an edge between them. Note also that m=0m=0 is fine, it just means that P0P_0 is directly adjacent).

When QQ is Empty and PmP_m is non-empty, QQ is called a liberty of the connected component containing PmP_m.

In the example below we consider several cases at once.

Example 2
Go board diagram

This is a possible board, though very unlikely to happen (very artificial moves).

  • AA only reaches Empty, doesn’t reach Black.
  • BB, on the other hand, does reach Black (and Empty). There is a white path from BB to a black point.
  • CC only reaches White (CC is an empty point and there are lots of paths made of empty points from CC to a white point).
  • DD reaches both White and Black.
  • BB can’t be said to reach White, even though it touches a white point, because reaching is only defined for different colors.
  • For the same reason, CC and DD can’t be said to reach Empty.

Clearing

We are now interested in stones/points that don’t reach Empty. When we describe the actual game loop we’ll see that such stones are dead.2

Example 3
Go board diagram
The black stone/point doesn’t reach Empty and is therefore dead.
Example 4
Go board diagram
None of the white stones reach Empty, they are also dead.

Hopefully you can see that white points like the above form a cluster such that if one of the points reaches Empty, all of them do.

Proof

Let GcGG_c \subseteq G be the subgraph of points colored cc, and let SGcS \subseteq G_c be a connected component of GcG_c (i.e., a subgraph of GcG_c where for every two points there exists a path from one to the other and the subgraph cannot be enlarged without breaking the connectedness).

Proposition: If BSB \in S reaches Empty, AA reaches Empty AS\forall A \in S.


Proof: Since BB reaches Empty, there exists a path BC=(B,,C)GcBC = (B, \ldots, C) \subseteq G_c from BB to some point CC adjacent to an empty point DD of the full graph GG. Since SS is a connected component of GcG_c, we also have that CSC \in S. That means that, for every ASA \in S, there exists a path ACGcAC \subseteq G_c that ends at CC, which is adjacent to DD. Therefore AA reaches Empty.\square

Example 5
Go board diagram
This white cluster is alive for now (one of its points is adjacent to an empty point, so they all reach Empty), but it’s easy to see that it’s going to die if white doesn’t do something about it.

Clearing a color cc means finding all the points of that color that don’t reach Empty and setting their color to Empty. In example 4 this would correspond to removing the dead white stones.

Note that clearing Empty is allowed by this definition but doing so doesn’t change anything.

Moves

A move is performed by a player, and it consists of 3 steps:

  1. Setting the color of an empty point as the color of that player. (In real life, this corresponds to placing a stone of the color of that player).
  2. Clearing the color of each opponent (simultaneously).
  3. Clearing one’s own color.

This is better seen with an example.

Example 6
Animated Go board
At first, there are 7 white stones. White puts an 8th, which doesn’t produce any clearing. Then, black places a stone and clears two groups of white stones (the 7 stones marked □ and the single stone marked △). After that, no clearing of black is necessary, even if for an instant it looks like the black stone doesn’t reach Empty.

The example above shows that the order of clearing is important: you can place the black stone on a point where it wouldn’t reach Empty and it doesn’t die, because it’s clearing the white stones first. After the clearing, the black stone does reach Empty, so it doesn’t get cleared in step 3.

In truth, it’s impossible to clear both some enemy stones and your own on the same move. But before that, note that, after a move:

  • Exactly one empty point changes color (the one where the stone was placed), unless it got cleared in step 3.
  • Non-empty points might change to empty through clearing.
Proof

We assume, without loss of generality, that it’s Black’s turn.

Notation. Let:

  • λ\lambda be the coloring at the beginning of a black turn.
  • μ\mu be the coloring after placing the black stone at PP.
  • ν\nu be the coloring after clearing all opponent colors, but before clearing Black.
  • λfinal\lambda_{\mathrm{final}} be the coloring at the end of the turn.
  • By “cluster” we’ll mean a connected component AA where all points are of the same non-empty color.
  • The set of liberties of a cluster AA under the coloring φ\varphi is Lφ(A)L_{\varphi}(A). Since every non-empty point XX belongs to a unique cluster under a coloring φ\varphi, and liberties are defined only for clusters, we may also write Lφ(X)L_{\varphi}(X) as a shorthand for Lφ(A)L_{\varphi}(A).
  • Interpret λ(A)\lambda(A) as λ(X)\lambda(X) for some XAX \in A. Since AA is a cluster, all points in it have the same color.

Proposition:

Assume that every cluster reaches Empty before black plays.

Let PVP\in V be the empty point where black plays, meaning:

λ(P)=0,μ(P)=B,μ(X)=λ(X)XP\lambda(P)=\mathsf 0, \quad \mu(P) = \mathsf B, \quad \mu(X)=\lambda(X)\quad \forall X\neq P

(i.e., PP starts empty, becomes black, and no other point becomes black).

We are going to prove that if there exists some set of points SVS \subset V forming an opponent cluster under λ\lambda that gets cleared after the move, that is:

Sλ(S)=c and λfinal(Y)=0YS \exists S \mid \lambda(S) = c \: \text{ and } \: \lambda_{\mathrm{final}}(Y) = \mathsf 0 \quad \forall Y \in S

Then, the newly placed stone doesn’t get cleared:

λfinal(P)=B(1)\lambda_{\mathrm{final}}(P)=\mathsf B \tag {1}

and no pre-existing black cluster is cleared either, i.e.:

λ(X)=B    λfinal(X)=B(2)\lambda(X)=\mathsf B \implies \lambda_{\mathrm{final}}(X)=\mathsf B \tag {2}

Proof:

Step 1 (λμ\lambda \to \mu): Placing a stone at PP.

As already stated, μ(P)=B\mu(P)=\mathsf B, nothing else changes color.

Step 2 (μν\mu \to \nu): Clearing opponents.

Black points don’t change, so in particular ν(P)=B\nu(P)=\mathsf B.

Let SS be an opponent cluster cleared after Black plays at PP. Then

Lλ(S),Lμ(S)=L_\lambda(S)\neq\varnothing, \quad L_\mu(S)=\varnothing

and the only point that changed color between λ\lambda and μ\mu was PP, therefore, PP was the only remaining liberty, i.e.:

Lλ(S)={P}L_\lambda(S)=\{P\}

So there exists some QSQ\in S adjacent to PP, that is, {Q,P}E\{Q,P\}\in E.

Since SS is cleared when passing from μ\mu to ν\nu, in particular, QQ is cleared: ν(Q)=0\nu(Q)=\mathsf 0.

Step 3 (νλfinal\nu \to \lambda_{\mathrm{final}}): Clearing black.

Since ν(Q)=0\nu(Q)=\mathsf 0 and PP and QQ are adjacent, PP has a liberty under ν\nu, i.e QLν(P)Q \in L_\nu(P).

Therefore the black component containing PP reaches Empty and is not cleared:

λfinal(P)=B\lambda_{\mathrm{final}}(P)=\mathsf B

This proves (1)(1).

Now let HH be any black connected component under ν\nu.

  • If PHP\in H, then, Lν(P)=Lν(H)L_\nu(P)=L_\nu(H)\neq\varnothing. It reaches Empty and therefore doesn’t get cleared.
  • If PHP\notin H, then HH consists only of black stones that were already present before the move. That means that it reached Empty under λ\lambda through an empty point RR different from PP (if PP were a liberty of HH under λ\lambda, PP would be in HH after Step 1). Since RPR \neq P, λ(R)=μ(R)=ν(R)=0\lambda(R)=\mu(R)=\nu(R)=\mathsf 0. HH reaches empty under all those colorings and therefore doesn’t get cleared.

That proves (2).\square

Note that we add the third step because placing a stone where it would die is allowed under Tromp-Taylor rules (not so in other rulesets, where such “suicide” is forbidden).

Territory and score

The territory of color c0c \neq \mathsf 0 is the set of empty points that only reach cc:

Tc(λ)={PVλ(P)=0,P reaches only c}T_c(\lambda) = \left\{P \in V \mid \lambda(P)=\mathsf 0, \: P \text{ reaches only } c \right\}

The score of a player color cc is the number of points of their color plus the territory of that color. In mathspeak:

Vc(λ)={PVλ(P)=c}V_c(\lambda) = \left\{P \in V \mid \lambda(P)=c \right\}

score(λ;c)=Vc(λ)+Tc(λ)+K(c)\operatorname{score}(\lambda; c) = |V_c(\lambda)| + |T_c(\lambda)| + K(c)

The term K(c)K(c) is komi, an adjustment for the fact that Black moves first and is expected to finish with a higher score. For the general NN-player game, each player would receive a different K(c)K(c).

Example 7: scoring
Go board

The circles and triangles are empty points. The circles only reach black and the triangles only reach white. There are 11 black points and 4 empty points that only reach Black. Black’s score is therefore 15. White’s score is 11+2=13.

Here we are obviously assuming no komi (K(B)=K(W)=0K(\mathsf B)=K(\mathsf W)=0).

As you can see, a player’s score is just a function of the coloring. Here are some examples of things that don’t matter for scoring in this way:

  • Whose turn it is.
  • Previous states.
  • Future states, including, for example, which points are likely to stop reaching empty.

The last bit requires some further comments. Take the board from the previous example. The black stones on the top-left corner are about to die, they are one move away from not reaching empty. This doesn’t matter for the score as defined above. Of course, this also suggests that the current score can be quite misleading for unfinished games. We’ll get back to that later.

Rules of the game

I will assume there is no handicap for now.

Rules:

  1. Assign players to colors. The colors have a fixed turn order c1,,cNc_1,\ldots,c_N. In ordinary two-player Go, these are Black then White.
  2. The game starts with all points colored empty.3
  3. During their turn, the player can either move (place a stone) or pass.
  4. A player may move in any empty point, provided that the resulting coloring after the move wasn’t already seen in the game (i.e., if a player moved in turn ii, λi=λj,j<i\lambda_i = \lambda_j, \: j < i is illegal).
  5. The game ends after NN consecutive passes, where NN is the number of players.
  6. The winner of the game is the one with the highest score (ties are allowed).

As you can see, we can’t fully describe the game state with just the current coloring and knowing whose turn it is. We also need to know the previous colorings to check the legality of moves. That rule is called Positional Super-Ko (PSK), and it is necessary to avoid infinite loops.4 Repeated colorings are fine if they come from a player passing, of course.

More on komi

The specific amount of komi is always debated. In principle, it should be set to whatever amount makes it equally likely that black or white win when the color each player gets is decided at random. That means that the 6.5 komi is contextual, and different graphs should get different komi. Presumably, with 3+ players, komi should increase the longer it takes for the player of color cc to make the first move, starting from 0 for black.

In one server I could find that allows for 3+ players, there seems to be no komi (for whatever reason). These servers don’t seem to have too many players, though, so things could change with more experience.

Handicap

The traditional Japanese handicap system lets the weaker player play black and have some stones pre-placed for them. Then, white makes the first real move. The idea behind it seems to be to teach the weaker player how to play Go by giving them a good initial placement regardless of how they feel like.

That rather opinionated system generalizes poorly, of course, and other systems give the weaker player free placement of the stones, like in China. It’s the Tromp-Taylor proposal as well, and I think it’s fine. You should still try to fine-tune it to make it so that every player has an equal probability of winning though, and I feel like even if you do so correctly, this method will have more variance than the Japanese version. Which might be a feature, not a bug, I’m unsure.

Another obvious option is to simply give komi to the weaker players, of course. Why have two systems when you could just use one? It’s interesting that the Tromp-Taylor approach is so minimalistic in general, yet it doesn’t reuse komi for this.

Can a system of pre-placed stones be defined for arbitrary graphs and players? I doubt it, but it’s an interesting thing to try to define, even if it ends up being reasonable only for some families of graphs.

Comments and some potential questions

Can I surrender?

In practical implementations, of course it’s allowed and it’s very common. In theory, however, under Tromp-Taylor you can only pass and you are forced to watch the game until the end of time or until you decide not to pass again, for some reason.

Can groups of stones that don’t reach Empty be on the board despite being dead?

Before the first move, no, because all the points are empty, so there are no stones.

After a move finishes, again no, for two reasons:

  1. A move clears all player colors.
  2. Clearing colors expands the number of empty points, so the number of points that reach Empty can only go up or stay the same. It can’t happen that, after clearing, some stones are suddenly dead that weren’t so before.

I think I might add an induction proof as an edit at some point.

Is the game guaranteed to stop?

Yes. Remember that we required finite graphs. A graph with V|V| vertices and C|\mathcal C| colors has CV|\mathcal C|^{|V|} possible colorings. That finite number is actually way bigger than the actual number of possible configurations in Go, since many of those colorings are illegal or impossible to produce in a game. Furthermore, PSK makes the set of unseen colorings shrink with every non-pass move. At some point, there are no more legal moves (worst case, because all the colorings have been seen) and players are forced to pass. When all players pass, the game ends.

Of course, all players will pass way before they run out of legal moves (remember that suicide is legal, so if they had to play every possible legal move they’d need to start committing suicide at some point! That doesn’t sound fun at all).

That brings us to the important point of early stopping of games, but first we need to talk about another life or death matter.

Life and death

A consequence of the rules of Go that is not obvious to anybody on a first reading of the rules is that some clusters (also called “groups”) of stones are impossible to capture. Sometimes the unkillable “cluster” is not even one cluster but two or more! Consider this situation:

Example 8
Go board diagram
It looks like white can capture (kill) those black stones, the only thing required is to fill the two points marked △. But how? If you place a white stone on one of those places, both of the black groups still reach Empty, but your stone doesn’t! This is suicide, which is allowed under Tromp-Taylor rules (not so in other common rulesets), but in this case it’s not even legal because the coloring would be exactly the same as before. As White, there is absolutely nothing you can do about this “group” of black stones, and they are said to be alive unconditionally.

Early stopping of games

As we explained, playing out the games until there are no more possible moves is not just tiresome and pointless but undesirable, since it’d force players to make suicidal moves. Much like in chess, people often surrender earlier. In Go, it’s actually way earlier.

This means that, as a matter of actually playing and having fun, we need some way of stopping early and agree on who won. Trouble is, it’s computationally infeasible to search all the possible plays.5 Worse, if you stop early, under these rules the score could be seemingly anything. Consider the following example:

Example 9
Go board diagram
Before playing the white stone, black has a lot of territory in the center (marked with tiny black squares). Notice how placing just one tiny stone shifts the score considerably (and the winner, if the game were to end at that very moment). Recall that, before placing the white stone, all those empty points reach only Black, so they are black territory. After placing it, however, they reach both Black and White, so they’re nobody’s territory.

So how can we make this work?

Traditionally, when both players pass, the game doesn’t actually end. Players need to agree on which groups of stones are unkillable (“alive”) and which ones are effectively dead. The lonely white stone in the example above would most certainly be considered dead by any reasonable player. I believe it’s actually impossible for white to “make life” inside that territory if black plays even mildly competently (let alone optimally). But what if White doesn’t agree? Here the answer varies between rulesets. The messier ones, such as the Japanese and Korean rulesets, need a sandbox of sorts during the so-called confirmation phase: players play out the local situation they disagree about, and once the stones have been shown to be alive or dead, the game is reset to the position before the sandboxed sub-game. The need for this sub-game is a consequence of how they define score that I won’t get into. Suffice it to say that the other systems, the so-called “area-scoring” rulesets, like the Chinese, the American, and others, also make players play out their disagreements, but they don’t require a sandboxed sub-game.6

Automated systems use heuristics to determine what’s alive and what’s not and choose to pass when there’s nothing good to do. GNU Go, for example, does this.

Another possibility would be to use superhuman AI programs like KataGo as an arbiter/oracle to tell you who won. However, at the moment of this writing, it has some systematic flaws that can be exploited, so it can’t function as an oracle of truth for tournaments (pro players would specifically optimize for KataGo, as opposed to winning in the opinion of other experienced humans). You might think of using it casually, among weak players, and that can work. Only issue is that sometimes you won’t understand why it says that some player lost. To the inexperienced eye, things that are dead can look alive and vice versa. And even if you agree, a weak player would blunder in playing out the life and death situations, so KataGo is not representative of “what would have happened if we both played this out until the end?”, which is what you probably wanted.

To me, this all means that the traditional agreement mechanism is practical, and it works. But ideally, newbies would have their endgame watched by some strong player so he can guide them on which groups are alive and dead. Then, after they decide who won in this way, they can also play it out and see for themselves if they want.

Where can I play Go?

If you live in a big city, chances are there is a go club somewhere. But that’s contextual. My general recommendation is OGS, which is a western server and it’s, of course, free. Start a custom game with the following settings (they should get automatically stored as your default for other games afterwards):

  • Board size: 9x9
  • Rules: Chinese
  • Game Speed: live
  • Time Control: Byo-Yomi
  • Main time: 5 minutes
  • Time per period: 15 seconds
  • Periods: 5

You can leave the rest at the default settings.

I need more help understanding this game

Unless you are a very careful and thoughtful reader, you will likely need to watch some tutorials for complete beginners to fully grasp the rules and their immediate implications. I suggest the first 5 videos in this playlist. After that, just play some games, try to improve by yourself and if you find yourself stuck, take a look at the Clossi Approach videos. They are fantastic. Just watch the first and try to apply the stuff in further games. Only then watch the second.

I also benefitted from reading Go For Beginners. However, it uses Japanese rules without explaining the sandbox mechanism, which is a big omission in my view and makes some examples confusing.

Beyond the standard grid

There is a website with variants of Go. Some are just Go on unusual graphs, like:

Sunflower
Go board diagram
The full game can be seen here.

You can even play it on a cube:

Go on a cube
3D go board with some stones on its surface
You can interact with it here. This could actually be made with magnets and a 3D printer…

A server that allows for 3+ players is this. However, it only admits square grids. Another problem with this multiplayer Go is that it’s too easy to kill stones:

Easy kill
A black stone surrounded by stones of different colors
I play Black. Then, before I ever get another turn, the other players gang on my poor little stone.

I think a fix, at least for 3 or 4 player games, is to create a different grid, one where each vertex has more edges:

Triangular tessellation with hexagonal shape
A Go board made of triangles

In this grid, only 6 vertices have 3 edges, the ones on the corners. The ones on the sides have 4 edges, and interior vertices have 6 edges. This makes it way more difficult for players to kill stones, so it should compensate for the problem described above.

The grid in this example has 331 points, and it’s therefore similar in size to the 19x19 board, which has 361.

I have yet to find a way of testing this board in real play, there’s seemingly no server that would allow both this board and 3+ players.

I should also mention that this should be easy to make with a wooden board and a laser engraver. I might order one.

Conclusion

Go is one of those games where the rules are simple (or can be), but getting good is really hard. The game has been around for millennia and it shows. It also has some really dedicated players and professionals. I believe it’s well worth a chance and if not, then I hope at least this post was interesting to you.

Just don’t get stuck in infinite loops.


  1. As a programmer you might be tempted to think of a struct {.vertex, .color}, but the math is cleaner and the reading is easier if we separate the color as its own thing. Imagine that we have an array of vertices, an array of edges (adjacency matrix) and an array of colors. The .get() method of the color array would be the λ\lambda function that we are talking about here. ↩︎

  2. Or “captured”, though this term makes more sense in rulesets like the Japanese. ↩︎

  3. You could change this rule to allow for different initial colorings, provided that they don’t contain dead stones. ↩︎

  4. Another option is considering both the coloring and whose turn it is, which is called Situational Super-Ko (SSK). You need either one of these rules for the game to end. Both methods are equally easy to implement: in PSK you make an array of hashes, where each hash is a function of the coloring; while for SSK each hash is a function of the coloring and a boolean specifying whether it’s white’s turn or black’s (or maybe an 8-bit unsigned integer if you want more players). Either way, not difficult. SSK is closer to what you intuitively care about: not going back to a game state exactly identical to a previous one. If the coloring is the same as before but it’s someone else’s turn now, it’s just not the same situation as before, so in principle it should be allowed. PSK forbids it, SSK allows it. Note, however, that neither PSK nor SSK account for all the Groundhog Day-type situations. For example, in a square grid, a 90-degree rotation of a past coloring would be allowed under both PSK and SSK, yet it’s clear that you are back to the same situation. This doesn’t change the fact that the game is finite, however, it’s just annoying. ↩︎

  5. Which is why machines didn’t beat even strong amateur players until the 2010s, you can’t just do a tree search. ↩︎

  6. Tromp-Taylor is also rightly considered area-scoring (“area-scoring” just refers to the fact that stones on the board are counted as score of the owner, unlike territory-scoring systems, where they don’t count). But as you can see it doesn’t have any early stopping mechanism like other rulesets in “its family”. In theory, Tromp-Taylor gets played until the very end. In practice, it’s always implemented with ways of stopping early. Again, this ruleset is theoretical and mathematically clean, in practical implementations some things change. ↩︎