On this site you can play the game of Reversi in 2D or 3D, against a human, or one of a number of AI players. You can also play a
If you are up to it, or you feel adventurous, you can click right here (or on the main heading of this page) and start playing Reversi right away. Otherwise, read the information here and then proceed to the actual game page. It probably is best to open the game table in a different window and refer to it, and try things out, as you proceed. However, you can also see a static image of the game table here.
If you are familiar with my Mill game you will find that the Reversi game is organized similarly.
You can skip this section if you are interested only in the Reversi game. I developed the Mill game first and learned a lot in the process. While the organization and the basic approach for the two games are closely related, there are some significant differences:
The game of Reversi (also known as Othello) is usually played on an 8x8 2D Board, as shown in Figure 1. The novel feature of this online version is that you can play it in 3D. But the easiest way to understand the rules is to start with the 2D rules. The transfer of those rules to the 3D case will be straightforward.
![]() |
| Fig. 1: Initial Board |
The game is played by two players, usually denoted as Black and White. However, when I first played Reversi many years ago the players were
Figure 1 shows the initial state of the 8x8 2D Board. There is a grid with 8x8 = 64 intersections. At the start of the game there are red markers on 4-5 (horizontal-vertical) and 5-4, and green markers on 4-4 and 5-5. The players take turns placing markers on the board. Their goal is to enclose contiguous chains of the opponent's pieces between two pieces of their own. If they can do that the pieces in the enclosed chain change colors. The player with the most pieces at the end wins. For example, at the beginning, Red could play on 4-3 or 3-4 and flip 4-4, or play on 6-5 or 5-6 and flip 5-5.
The following four boards illustrate a possible sequence of the first four moves. The picture shows the status of the board
|
|
|
|
Here is a list of specific rules:
To illustrate some aspects of the game, note the following:
The 3D game is played exactly like the 2D game, except that now there are more neighbors for each point, and the chains of enclosed pieces can run in more directions. In fact, the number of directions increases from 8 to 26 neighbors. To see this note that an interior point and its neighbors in the grid form a 3x3x3 cube which contains 27 points. The innermost point is not a neighbor of itself, so that point has a total of 33-1 = 26 neighbors, each corresponding to a potential chain of enclosed opposing pieces. (On a 2D board we have 32-1 = 8 neighbors, and in n dimensions we have 3n-1 neighbors). You can place pieces in a three-dimensional array by using the interactive 3D display or in a two-dimensional cross section of the board.
You can start the game right here. If you wonder what a specific control does you can hover over it and see a one or two word explanation pop up. However, you may prefer to read the detailed information below to know what this software does and get an idea of how it works.
The Table with the controls, the 3D game board, and three Cross sections by default measures about 1631 by 1039 pixels. This is quite large (certainly unrealistic to be used on a smartphone) but it fits on most modern lap or desktop screens. You may need to change the resolution setting on your screen to accommodate the whole table. You can also shrink the size of the table in the line labeled
The default game table, meant for playing 3D Reversi, consists of three columns. The first column contains the game controls. The second consists of three cross sections, each of which is perpendicular to one of the three axes. The third column contains the three-dimensional board. You can also toggle the display to play in just two dimensions (by clicking on the button in the second row of the control column). In that case the middle column (with the cross sections) disappears and the game board turns two-dimensional.
Players may be human or one of ten AI players. To play a game select the participants in the lines labeled
The 3D game board is moving in space initially to suggest that this is an interactive 3D display, and you can manipulate the game board to help you visualize the 3D game state. Specifically, you can:
You can also place markers on the 2D cross sections. There is one cross section for each axis. You can toggle a display of the axes in the 3D board by typing 'A'. The radio buttons underneath each 2D board let you choose which of the possible cross sections is being displayed.
This section contains a description of the available controls, listed from top to bottom.
The textfields corresponding to these categories show the numerical values corresponding to the player specified with the menu on the left in the next row. You can change the values of those textfields, and change the behavior of the corresponding AI.
The following keyboard commands are available:
Modern computers usually have a number of cores, or CPUs, and can run several
My own system provides 32 threads. When running a tournament or an Evolution the system frequently runs at a CPU utilization of 100 percent. However, the savings as far as the time required for the computation of a move, and the number of nodes visited, is not nearly as dramatic.
To illustrate this I had the system compute the first ply on the 6x6x6 board at depth 8, with the number of workers ranging from 1 to 32. JS does not let you measure CPU time accurately, and CPU time is of limited utility when running processes simultaneously. The times shown here are wall-clock time measured in milliseconds. However, other than routine system tasks, there were no other processes running on the system at that time. This chart shows wall-clock time plotted against the number of workers, on a log-log scale:
The red line shows what one would naively expect. Thus when using W workers, the CPU time should be T/W where T is the time taken by one worker. The fat looking dots represent the actual wall clock time taken by three separate runs. The fact that those three times are very similar for each number of workers indicates that the shape of the curve formed by the dots is not random. Thus increasing the number of workers in some circumstances actually increases the time used for the calculation. The reason for this is that the evaluation of some positions takes longer than others, and if the number of computer intensive positions is concentrated on a small number of workers the time required will increase. Of course, the precise values of the individual worker times depend on the current position.
A rudimentary understanding of how the computer plays is useful for understanding how to use the controls. Here is an extremely terse introduction: The moves available to the computer form a tree rooted at the current board position. The computer examines that tree to a certain depth. It uses a formula (the
There are many references to
The following Table illustrates the performance of the computer algorithms on my particular Windows 11 machine. The software offers two engines, one written in JavaScript (JS), and one written in C++. As discussed above, the JS engine performs essentially just as well as the C++ engine, which is a significant difference between the Mill and the JS codes. Note that, while the JS version works with essentially any browser, the C++ engine may not work on your particular computer. It requires a compiled version of the C++ code that is part of the package.
The Table shows the time and the number of nodes visited in the Game Tree, for the computation of the first move on the 6x6x6 board, at depths running from 2 to 14 plies (i.e., half moves, move by just one player), employing 32 workers, and running on Google Chrome. There are two blocks in the Table, the first one corresponding to the C++ engine, the second corresponding to the JS engine. The Table shows data for a computation of the first move. The row headed
| Metric | Engine | Depth 2 | Depth 4 | Depth 6 | Depth 8 | Depth 10 | Depth 12 | Depth 14 |
|---|---|---|---|---|---|---|---|---|
Nodes |
C++ |
34 |
2,608 |
77,397 |
2,107,038 |
43,071,461 |
961,661,893 |
24,316,471,858 |
| Time (ms) | C++ | 1 | 6 | 92 | 2,680 | 55,060 | 1,254,422 | 21,034,466 |
| Nodes/Time | C++ | 34.0 | 434.7 | 841.3 | 786.2 | 782.3 | 766.6 | 1,156.0 |
| Time Factor | C++ | - | 6.0 | 15.3 | 29.1 | 20.5 | 22.8 | 16.8 |
Nodes |
JS |
34 |
2,608 |
77,370 |
2,104,391 |
42,871,518 |
959,278,928 |
- |
| Time (ms) | JS | 4 | 13 | 113 | 2,774 | 58,083 | 1,379,941 | - |
| Nodes/Time | JS | 8.5 | 200.6 | 684.7 | 758.6 | 738.1 | 695.2 | - |
| Time Factor | JS | - | 3.3 | 8.7 | 24.5 | 20.9 | 23.8 | - |
Time (JS/C++) |
Ratio |
4.00 |
2.17 |
1.23 |
1.04 |
1.05 |
1.10 |
- |
It is evident that JS and C++ perform similarly. It seems reasonable for a human to play against an AI at a depth of 8 or 10 (looking ahead 4 or 5 full moves). This will make the computer move in a few seconds or minutes. Human players of course can take any amount of time they wish.
The following Table shows similar data for computing the first move on the 2D 8x8 Board, again with 32 workers. This is the classic version of Reversi. All possible first moves are equivalent by symmetry. Therefore, for these particular data, the Symmetry check was turned off. Clearly the branching factor is smaller for a 2D Board, than in 3D, and as a consequence play can take place at a larger search depth. Depth 10 and 12 are reasonable AI search depths, and with some patience you might even play against an AI thinking at depth 14. It would be looking seven full moves ahead, which is likely to make the game challenging even for expert Reversi players. Remarkably, the JS Engine actually performs better than the C++ engine for most values of the search depth.
| Metric | Engine | Depth 2 | Depth 4 | Depth 6 | Depth 8 | Depth 10 | Depth 12 | Depth 14 | Depth 16 | Depth 18 |
|---|---|---|---|---|---|---|---|---|---|---|
Nodes |
C++ |
17 |
203 |
1,839 |
19,935 |
224,686 |
2,484,667 |
27,714,174 |
306,469,888 |
3,871,006,168 |
| Time (ms) | C++ | 1 | 2 | 13 | 91 | 957 | 13,285 | 150,430 | 1,838,486 | 21,775,397 |
| Nodes/Time | C++ | 17.0 | 101.5 | 141.5 | 219.1 | 234.8 | 187.0 | 184.2 | 166.7 | 177.8 |
| Time Factor | C++ | - | 2.0 | 6.5 | 7.0 | 10.5 | 13.9 | 11.3 | 12.2 | 11.8 |
Nodes |
JS |
17 |
203 |
1,839 |
19,935 |
224,686 |
2,484,667 |
27,714,174 |
306,469,888 |
3,871,006,168 |
| Time (ms) | JS | 1 | 5 | 9 | 79 | 934 | 11,602 | 140,105 | 1,438,403 | 34,851,094 |
| Nodes/Time | JS | 17.0 | 40.6 | 204.3 | 252.3 | 240.6 | 214.2 | 197.8 | 213.1 | 111.1 |
| Time Factor | JS | - | 5.0 | 1.8 | 8.8 | 11.8 | 12.4 | 12.1 | 10.3 | 24.2 |
Time Ratio |
JS/C++ |
1.00 |
2.50 |
0.69 |
0.87 |
0.98 |
0.87 |
0.93 |
0.78 |
1.60 |
The following Table lists the built-in AI players and their parameters explained above. They are ordered by decreasing performance in a specific tournament on the 6x6x6 board at depth 4, with 32 workers running on Google Chrome, playing 100 games for each pairing, for a total of 9000 games. So Arwen is the top player in that tournament, and Jolly places last, by definition. Jolly's parameters values represent my first guess at reasonable values, all other players are descendants of Jolly, in one way or another, by the built-in evolution process. Multiplying all weights with a constant positive factor will not alter the game play of the AI, therefore the largest weight is normalized to be 1000. All weights are integer. Unsurprisingly, placing a marker in a corner, almost whenever you can, receives the highest priority.
| Player | Mob | Dif | Cor | C-Sq | X-Sq | Edg | IEd | Fac | IFa |
|---|---|---|---|---|---|---|---|---|---|
Arwen |
13 |
7 |
1,000 |
-1 |
-9 |
97 |
-2 |
4 |
-1 |
| Bilbo | 13 | 6 | 1,000 | -1 | -8 | 94 | -3 | 4 | -1 |
| Celebrian | 14 | 6 | 1,000 | -1 | -8 | 91 | -3 | 4 | -1 |
| Dwalin | 13 | 7 | 1,000 | -1 | -9 | 105 | -2 | 4 | -1 |
| Eowyn | 84 | 17 | 1,000 | -4 | -26 | 72 | -10 | 19 | -4 |
| Frodo | 14 | 9 | 1,000 | -1 | -7 | 94 | -3 | 5 | -1 |
| Galadriel | 141 | 10 | 1,000 | -8 | -70 | 89 | -20 | 14 | -4 |
| Hamfast | 15 | 22 | 1,000 | -9 | -19 | 132 | -2 | 2 | -2 |
| Indis | 18 | 23 | 1,000 | -8 | -20 | 76 | -6 | 5 | -2 |
| Jolly | 20 | 40 | 1,000 | -10 | -20 | 100 | -5 | 10 | -2 |
The following Table shows the outcomes of tournaments among all 10 AI players, on various boards and at various depths. The players are indicated by the first letter of their name, and also by a specific background color, to help recognize patterns. As mentioned before, the names reflect the performance of the players at search depth 4 on the 6x6x6 3D board, as indicated in the last row of the Table. There is a remarkable diversity among the rankings in the various board and depth combinations. As many as half the players (A, C, E, G, and H) are the champion in at least one combination. Eowyn is the most versatile player, earning seven gold medals. Even Jolly, whose parameters are based essentially on guess work, places second in two disciplines, on the 4x4x4 3D board at depths 2 and 6. On the other hand, Jolly places dead last in 5 of the tournaments.
| Board | Depth | Rank 1 | Rank 2 | Rank 3 | Rank 4 | Rank 5 | Rank 6 | Rank 7 | Rank 8 | Rank 9 | Rank 10 | Time (s) | Red Wins | Green Wins | Draws |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 6x6 | 2 | G | E | I | B | C | D | F | A | J | H | 7,939 | 1,779 | 6,392 | 829 |
| 6x6 | 4 | E | G | F | H | J | I | A | C | B | D | 67,399 | 6,961 | 1,783 | 256 |
| 6x6 | 6 | C | B | G | E | I | J | F | A | D | H | 521,201 | 3,925 | 5,043 | 32 |
| 6x6 | 8 | E | G | C | B | D | A | F | J | I | H | 3,383 | 3,041 | 5,559 | 400 |
| 8x8 | 2 | A | G | E | B | C | D | F | I | H | J | 75,390 | 4,183 | 4,447 | 370 |
| 8x8 | 4 | E | G | C | F | D | B | A | I | H | J | 1,405,360 | 4,044 | 4,753 | 203 |
| 8x8 | 6 | G | E | C | B | A | D | I | H | F | J | 23,074,428 | 3,779 | 4,923 | 298 |
| 8x8 | 8 | E | G | B | D | C | F | H | J | A | I | 272,907 | 4,198 | 4,510 | 292 |
| 4x4x4 | 2 | E | J | H | C | I | F | A | D | B | G | 16,055 | 1,792 | 7,126 | 82 |
| 4x4x4 | 4 | H | I | J | F | C | A | D | G | E | B | 450,601 | 7,215 | 1,665 | 120 |
| 4x4x4 | 6 | E | J | H | F | I | C | B | D | A | G | 9,329,508 | 4,393 | 4,383 | 224 |
| 6x6x6 | 2 | E | G | F | C | A | B | I | D | H | J | 1,600,027 | 4,754 | 4,129 | 117 |
| 6x6x6 | 4 | A | B | C | D | E | F | G | H | I | J | 78,061,633 | 4,312 | 4,578 | 110 |