Go (from Japanese *Igo*, "surrounding board game", also *Baduk* or *Wei-qi*) is possibly the world's oldest original-form two-player board [game](game.md), coming from Asia, and is one of the most beautiful, elegant, deep and popular games of this type in [history](history.md), whose cultural significance and popularity can be compared to that of [chess](chess.md), despite it largely remaining widely popular only in Asia (along with other games like [shogi](shogi.md), or "Japanese chess"). There however, especially in Japan, go is pretty big, it appears a lot in [anime](anime.md), there are TV channels exclusively dedicated to go etc., though in Japan [shogi](shogi.md) (the "Japanese chess") is probably a bit more popular; nevertheless go is likely the most intellectually challenging board games among all of the biggest board games. **Go is a bit difficult to get into** (kind of like [vim](vim.md)?) though the rules can be learned quite quickly; it is hard to make big-picture sense of the rule implications and it may take weeks to months before one can even call himself a beginner player. To become a master takes lifetime.
**Compared to chess** (some purists dislike this, see https://senseis.xmp.net/?CompareGoToChess) the rules of go are much more simple -- which is part of the game's [beauty](beauty.md) (see [easy to learn, hard to master](easy_to_learn_hard_to_master.md)) -- though the emergent complexity of those few rules is grandiose; so much so that to play the game well is usually considered more challenging than learning chess well, as there are many more possibilities and mere calculation is not enough to be strong, one needs to develop a strong intuition; this is also the reason why it took 20 more years for [computers](computer.md) to beat the best humans in go than in chess. Many say that go is yet deeper than chess and that it offers a unique experience that can't be found anywhere else; go is more mathematical, something that just exists naturally as a side effect of logic itself, while chess is a bit of an arbitrary set of more complex rules fine-tuned so that the game plays well. The spirit of go is also more [zen](zen.md)-like and peaceful: while chess simulates [war](war.md) (something more aligned with western mentality), go is more about dividing territory, one could even see it not as a battle but rather a creation of [art](art.md), beautiful patterns (something better aligned with eastern mentality).
**From [LRS](lrs.md) point of view go is one of the best games ever**, for similar reasons to chess (it's highly free, [suckless](suckless.md), cheap, [not owned by anyone](public_domain.md), [fun](fun.md), mathematically deep, nice for programming while the game itself doesn't even require a [computer](computer.md) etc.) plus yet greater [simplicity](minimalism.md) and beauty.
**Solving go:** similarly to chess the full game of go seems unlikely to be solved -- the 19x19 board makes the game state tree yet larger than that of chess, but the much simpler rules possibly give a bigger hope for mathematical proofs. Smaller boards however have been solved: Erik van der Werf made a program that confirmed win for black on boards up to (and including) 5x5 (best first move in all cases being in the middle of the board). Bigger boards are being researched, but a lot of information about them is in undecipherable Japanese/Korean gibberish, so we leave that for the future.
The rules of go vary a bit more than those of chess, they are not as much unified, but usually the details don't play as much of a role because e.g. different scoring systems still mostly result in the same outcome of games. Here we'll describe possibly the most common rule set.
The game's **goal** is basically to surround a bigger territory than the enemy player. The formal rules are pretty simple, though their implications are very complex.
Go is played by a black and white player, black plays first (unlike in chess) and then both players take turns placing stones of one's own color on squares -- a square is the INTERSECTION of the lines on the board, NOT the place between them (consider the lines to be carved in stone, the intersection is where the stone stands with stability). The stones are all the same (there are no different types of stones like in chess) and they cannot move; once a stone is placed, it stays on its position until the end of the game, or until it is captured by the enemy player. The board size is **19x19**, but for for students and quick games 13x13 and 9x9 boards are also used. As black plays first, he has a slight advantage; for this white gets bonus points at the end of the game, so called **komi**, which is usually set to be 6.5 points (the half point eliminates the possibility of a draw). Komi may differ depending on board size or a specific scoring system.
Any player can **pass** on his move, i.e. making a move isn't mandatory. However you basically always want to make a move, one only passes when he feels there is nothing more to be gained and the game should end. If both players pass consecutively, the game ends.
The game considers **4-neighborhoods**, NOT 8-neighborhood, i.e. squares that don't lie on board edges have 4 neighbors: up, right, bottom and left; diagonal squares are NOT neighbors.
**Capturing:** a player can capture a group of connected (through 4-neighborhoods) enemy player's stones by completely surrounding them, or more precisely by taking away all so called **liberties** of that group -- *liberty* is an empty square that's immediately neighboring with the group (note that liberties may lie even inside the group). If a player places his stone so that it removes the enemy group's last liberty, then the group is removed from the board and all its stones are taken as captured. It is possible to capture stones by a move that would otherwise be forbidden as suicide, if after the removal of the captured group the placed stone gains a liberty.
**[Suicide](kys.md) is forbidden:** it is not allowed to place a stone so that it would immediately result in that stone (or a group it would join) being captured by enemy. I.e. if there is an enemy group with one empty square in the middle of it, you cannot put a stone there as that stone would simply have no liberties and would immediately die. Exception to this is the above mentioned taking of a group, i.e. if a suicidal move results in immediately taking enemy's group, it is allowed.
The **ko** rule states that one mustn't make a move that returns the board to the immediately previous state; this basically applies just to the situation in which the enemy takes your stone and you would just place it back, retaking his capturing stone. By the *ko* rule you cannot do this IMMEDIATELY, but you can still do this any further following round. Some rulesets extend this rule to so called *superko* which prohibits repetition of ANY previously seen position (this covers some rare cases that can happen).
**Territory:** at any time any EMPTY square on the board belongs either to white (no black stone can be reached from it by traveling over neighbors), black (no white stone can be reached from it) or none (belongs to neither). Squares that have stone on them aren't normally considered to belong to anyone (though some scoring systems do), i.e. if you surround a territory as white, only the VACANT surrounded squares count as your territory. The size of territory plays a role in final scoring. An alternative to territory is **area**, which is territory plus the squares occupied by player's stones and which is used under some rulesets.
**Prisoners** are enemy's stones that are OBVIOUSLY in your territory and so are practically dead. I.e. they are inside what's clearly not their territory and with further play would clearly be captured. Obvious here is a matter of agreement between players -- if players disagree whether some stones are obvious prisoners, they simply keep playing and resolve the situation.
**Scoring:** scoring assigns points to each player when the game is over, the one with more points win. There are multiple scoring systems, most common are these two:
- **Chinese** (area scoring): more [KISS](kiss.md), the score is just each player's area (surrounded empty square PLUS squares occupied by the player's stones), plus komi for white.
- **Japanese** (territory scoring): At the end of the game we count the score for black as the size of black's territory PLUS one point for each stone black has captured PLUS one point for each white prisoner (a would be captured stone) in black's territory. Score for white is computed analogously but we also add the komi compensation.
Here black's (`#`) territory is 23, and black made 9 captures during the game, giving together 32 points. White's (`O`) territory is 16 and he has one black prisoner (H2), giving 17 points; furthermore white made 6 captures during the game and gets 5.5 (smaller value due to only 9x9 board size) bonus points as komi, totalling 28.5 point. Therefore black wins.
**Board representation:** a straightforward representation of the go board is as a simple [array](array.md) of squares; each square can be either empty, white or black, that's 3 values that can be stored with 2 bits, which allow storing 4 values, leaving one extra value to be used for some other purpose (e.g. marking illegal ko squares, estimated dead stones, marking last move etc.). 1 byte allows us to store 4 squares this way so we need only 91 bytes to represent the whole 19x19 board. On computers with enough RAM it may be considered to store 1 square in a single byte or int, making the board take more space but gaining speed thanks to data alignment (we don't need extra instructions for squeezing bit from/to a single byte). Of course we furthermore have to keep track of extra things such as numbers of captured stones.
The longest possible game without passes has 4110473354993164457447863592014545992782310277120 moves. The longest recorded professional game seems to be mere 411 moves long (Hoshino Toshi vs Yamabe Toshiro, 1950). There are 2.08168199382 * 10^170 legal positions on a 19x19 board, 3.72497923077 * 10^79 for 13x13 and 1.03919148791 * 10^38 for 9x9. The number of possible games is estimated from 10^10^100 to 10^10^171. An average high-level game lasts about 150 moves. Average branching factor is 250 (compare to 35 in chess).