Torus is a board game inspired by Go, invented by mathematician Emma Joe Anderson and physicist Erin Ewart in 2018. In the time since its invention, Torus has gathered a small community of enthusiasts, and many aspects of its strategy and theory have been explored and written about. However, despite this enthusiasm, there have so far been no completed efforts to build a computer program that plays Torus. With this in mind, the aim of this project is to create a Torus engine that can compete with human players. To establish the motivations and goals of this project, I’ll first explain the exact rules of Torus.
Rules of Torus#
Torus is played on a square board, on which alternating black and white stones are placed on the intersections of a grid by each player, starting with black. The player who is currently placing a stone is called the active player, and the other player is called the passive player. Similarly, the active player’s stones are called active stones, and likewise for the passive player. Although any size of board is technically possible, Torus is almost always played on a 9x9 board. Each point on the board is labeled as in Go, with the columns named after capital letters, and the rows named after numbers, so that each point can be expressed with a letter and a number, such as B3 or I7.
There are two objectives that may be accomplished by placing a stone in Torus. First and foremost, The active player wins the game by completely surrounding any one of the passive players stones in all four cardinal directions.
A game being won by blackSecond, the active player may remove the passive players stones by flanking them diagonally on two opposite sides. Any number of stones may be captured like this, so long as they all lie on the same diagonal line as the stones capturing them.
If black places in the location pictured here, the white stone is removed.
It is possible to remove multiple stones in a single row, or even in multiple rows simultaneously.Many moves in Torus are illegal. Of course, it is illegal to place a stone where one is already present. Additionally, The active player may not place a stone where it would be immediately removed by the passive player, or were it would cause the passive player to win.
Examples of illegal movesThere are two exceptions to this rule. First, it is always legal to play a move that wins the game, even in situations where the placed stone might be captured, or that cause an apparent victory for the passive player.
This move causes black to win, because black is the active player, even though it appears illegal.Second, the active player may play a stone into a location where it would be captured, if that move also removes the stone or stones that threaten the new move.
This move is legal, because the white stone that threatens it is removed first.Finally, a move is never legal if it causes the board to enter a state that is identical to any state it has had previously. This is similar to the ``ko" rule in Go, but it is more restrictive. In Go, it is illegal to return the board to the position it had in the previous turn \cite{Ko}, but in Torus, it is illegal to return the board to any previously held position. Therefore, this rule is referred to as \textit{super-ko}.
Finally, as the name of the game implies, Torus is played on a torroidal board, in which the edges connect to their opposite sides. This means that stones in the 9th row are adjacent to stones in the first row if they share a column, and stones in the 9th column are adjacent to stones in the first column if they share a row. For example, a board that looks like this:
A seemingly non-torroidal board.Actually looks like this:
A "wrapped around" version of the previous board. Here, the stone placed on I9 is adjacent to A9, and the game would be over if black were to play at I1.The two remaining rules are obscure and almost never applied. They are:
- The active player cannot capture a continuous line of 8 passive stones by playing a single stone in the gap between them. A capture requires an active stone currently being placed, and a distinct active stone that had been placed previously.
- If there are no available legal moves for the active player, the passive player wins.
The complete set of rules, as well of a starting exploration of the theory and strategy is available on Anderson’s website.
Project goals#
In a previous version of this project, everything was built from the ground up. The previous attempt was made without any built-in understanding of strategy, and the neural net was made entirely from basic structures in Python: strings, lists, and matrices realigned to jury rig a neural network. I’m still very proud of that old effort. There’s a certain beauty to taking the “AlphaZero” approach and witholding human biases to find what an unbiased machine thinks. Even so, AlphaZero was only built after an engine had already been built. With that in mind, I’m going to build the strongest engine possible, without any philosophical restrictions. How powerful can this engine get with no holds barred?