Configurations of Go 围棋变局

**Translated by Tao Steven Zheng (郑涛)**

**《梦溪笔谈·卷18技艺7》**
小说：唐僧一行[1]曾算棋局都数，凡若干局尽之。予尝思之，此固易耳，但数多，非世间名数可能言之。

今略举大数：凡方二路，用四子，可变八十一局；方三路，用九子，可变一万九千六百八十三局；方四路，用十六子，可变四千三百四万六千七百二十一局；方五路，用二十五子，可变八千四百七十二亿八千八百六十万九千四百四十三局；**【古法：十万为亿，十亿为兆，万兆为稊**[2]**。算家以万万为亿，万万亿为兆，万万兆为垓。今但以算家数计之。】**方六路，用三十六子，可变十五兆九十四万六千三百五十二亿八千二百三万一千九百二十六局[3]；方七路以上，数多无名可记。尽三百六十一路，大约连书万字四十三，即是局之大数[4]。**【万字四十三，最下万字即万局，第二是万万局，第三是万亿局，第四是一兆局，第五是万兆局，第六是万万兆，谓之一垓，第七是万垓局，第八是万万垓，第九是万亿万万垓。此外无名可纪，但四十三次万倍乘之，即是都大数，零中数不与。】**

其法：初一路可变三局。**【一黑、一白、一空。】**自后不以横直，但增一子，即三因之。凡三百六十一增，皆三因之，即是都局数。

又法：先计循边一行为“法”，**【凡十九路， 得一十亿六千二百二十六万一千四百六十七局。】**凡加一行，即 以“法”累乘之，乘终十九行，亦得上数。

又法：以自“法”相乘**【得一百三十五兆八百五十一万七千一百七十四亿四千八 百二十八万七千三百三十四局，此是两行，凡三十八路变得此数也。】**[5]下位副置之，以下乘上，又以下乘下，置为上位；又副置之，以下乘上，以下乘下；加一“法”，亦得上数。有数法 可求，唯此法最径捷。**【只五次乘，便尽三百六十一路。】**千变万化，不出此数，棋之局尽矣。
***Mengxi Bitan* Chapter 18 Jiyi 7**
According to a story, the Buddhist monk Yi Xing[1] of the Tang dynasty calculated the total number of different configurations that may be placed on a Go board. I have thought of the problem as well, and found the method of calculation rather straightforward. However, the number of configurations is so large that it cannot be properly expressed by the numbers that are commonly known.

Here I shall present some examples. If the board is a 2x2 square grid, then it has four positions, which can produce 81 different configurations. If the board is a 3x3 square grid, then it has nine positions, which can produce 19,683 different configurations. If the board is a 4x4 square grid, then it has sixteen positions, which can produce 43,046,721 different configurations. If the board is a 5x5 square grid, then it has twenty-five positions, which can produce 847,288,609,443 different configurations. **(According to the ancient number system: *yi* is 10 multiplied by 10,000, *zhao* is 10 multiplied by 100,000,000, *ti*[2] is 10,000 multiplied by *zhao*. However, for mathematicians, *yi* is 10000 multiplied by 10,000, *zhao* is 10,000 multiplied by 10,000 *yi*, and *gai* is 10,000 multiplied by 10,000 *zhao*. Here we use the calculation method of the mathematicians.)** If the board is 6x6 square grid, then it has thirty-six positions, which can produce 150,094,635,282,031,926[3] different configurations. If the board is a 7x7 square grid or larger, the number of different configurations is too large to be written out. Exhausting the 361 positions of a true Go board, the number of configurations is approximately the number 10,000 being written consecutively forty-three times[4].
**(This so-called “forty-three 10,000s” means the last 10,000 is 10,000, the second is 108, the third is 1012, the fourth is 1016, the fifth is 1020, the sixth is 1024, which is called one *hai*, the seventh is 1028, the eighth is 1032, the ninth is 1036.** **Beyond that there is no name to express it; however, the product of 10000 to the power of 43 is the approximate order of magnitude of this large number while the remaining digits are not included.)**

The method: first consider a point, which can have three possible configurations. **(Black, white, or empty.)** Each additional position, regardless if it is horizontal or vertical, will contribute an additional multiple of 3. When this is increased to 361 points, the total number of configurations is obtained by a multiple of 3 for every point.

Another method: First calculate the number of configurations of one side and take it as the “base number” (法 *fa*). (**There are 19 points in one line, so the number of configurations is 1,162,261,467.)** If one more line is added to it, multiply it by the “base number”. When it is multiplied 19 times, we get the same number.

Another method: First multiply the “base number” by itself. **(The product is 1,350,851,717,448,287,334[5], which is the number of configurations for two lines with a total of 38 positions.)** Then use the product as the multiplier and multiply the “base number” by the multiplier, and get the second result. After that, multiply the second product by itself and get the third product. Next use the third product as the multiplier and multiply it with the second product to get the fourth product. The total number of configurations is obtained after multiplying the product by itself and then multiplying it with the “base number”. Among these methods, this one is the quickest. **(Only five calculations were made to arrive at the answer for 361 points.)** Of all the myriad changes, the total number of configurations on a *weiqi* board will never exceed this number. This is indeed the final answer.

**【注释】**

[1] 一行：本名**张遂**（公元673年～公元727年），唐朝天文学家、数学家、发明家、僧人。

Yi Xing: Original name Zhang Sui (673 – 727 AD), astronomer, mathematician, inventor and Buddhist monk of the Tang Dynasty.

[2] “稊”应该写为“秭”。

The character “稊” *ti* should be written as “秭” *zi*.

[3] 正确数值应该是150,094,635,296,999,121。

The correct number should be 150,094,635,296,999,121.

[4] 沈括给出 10172，更准确数值大约为 1.7409 x 10172。

Shen Kuo gave the value 10172; however, the more accurate value is 1.7409 x 10172.

[5] 正确数值应该是1,350,851,717,672,992,089。

The correct number should be 1,350,851,717,672,992,089.

**【今译】**

据小说记载：唐朝僧人一行曾算过围棋时可能下出不同局面的总数，一共有多少局，他都算出来了。我也曾经考虑过，这当然容易。但棋局数目太大，不是用现在的大数名称可以表达出来。

现在我大略说一下。如果棋盘是两路见方，就有4个用子位置，可以变化出81种棋局；是三路见方，就有9个用子位置，可以变化出19683种棋局；是四路见方，就有16个用子位置，可以变化出43,046,721种棋局；是五路见方，就有25个用子位置，可以变化出847,288,609,443种棋局。**【根据古法：十万为亿，十亿为兆，万兆为秭。而算家以万万为亿，万万亿为兆，万万兆为垓。】**我们现在用算家的计算方法来计数。如果棋盘是六路见方，就有36个用子位置，可以变化出150,094,635,282,031,926\*种棋局。七路以上布局的，变化的局数无法记下来。如果将棋盘361路的变局全记下的话，大概要连写43个万字才是局的大致数字**。【43个万字，那么最后一个万字表示万局，第2个万字是万万局，第3个万字是万亿局，第4个万字是兆局，第5个万字是万兆局，第6个万字是万万兆局，万万兆为一垓，第7个万字是万垓局，第8个万字是万万垓局，第9个万字是万亿垓局。再往上就没有大数名词好用了。连接43次万倍相乘后所得的积数就是棋局总数的大概。这里只给出第一位的数字，其余的数字都略而不讲。】**

计算棋局的方法，第一个点可以有3种布局。**【或放黑子、或放白子、或空着不放子。】**从它出发，不论横直，每增加一个点，就多成一个3；一直增加到全盘361点，每次都多乘一个3，就得到棋局的总数。

另一种算法：先算出沿边一行的局数，这个数称为基本数，以此作为“法”**。【一行共 19 个点， 共得 1,162,261,467局。】**每加一行，就用“法”乘一次，乘尽 19 行，也得到上述的棋局总数。

还有一种算法：先用“法”自乘**，【得 1,350,851,717,448,287,334局，这是两行共 38 点变化出来的局数。】** 然后乘积作为乘数，用乘积乘“法”，再把两次的乘积相乘，得到第三次乘积；又把这个数作乘积，与第二次乘的积数相乘，再把所得的积相乘，又与“法”相乘，也能得到前段所讲的总数。求棋局总数有几种方法，只有这种方法最快捷。**【只须要五次运算就得出 361 个点所变化出的棋局总数。】**棋盘上可能布置出的局面千变万化，也不会超过这个数，棋局的总数就算尽了。