User Tools

Site Tools


This page describes some of the classic n-in-a-row games that are played on a rectangular grid. By convention, we refer to the colour of the first stone as black, and the other colour as white, but on Abstract Play, these colours are customisable (but by default, it is red and blue).

The games that we currently have in this family are

  • Gomoku
  • Renju
  • Pente
  • Connect6
  • Four In A Row
  • Irensei


Gomoku is traditionally played on a 15×15 board, and you win by having exactly five stones of your colour in a row orthogonally or diagonally. If it is a line of more than five stones, it is called an overline. Overlines don't count as a win and are ignored in Gomoku.

According to the official rules, you may pass at any point in the game, but in Abstract Play, since the pass move is also used to swap colours in certain openings, passing is disallowed for the first two moves after the opening phase to prevent accidental passing. The game ends in a draw if both players pass consecutively, or if the board fills up without any player winning.

Note that colloquially, the terms like Gomoku and Renju are used interchangeably in Japan and China (among the many other names), but officially and in Abstract Play, Renju is a separate game from Gomoku, and it will be described separately.

Opening rules

Because of the overwhelming first-move advantage, some opening rules have been proposed to make the game fairer. These openings are described here, but they may be implemented for other n-in-a-row games.


In the Pro opening, the first black stone has to be in the centre, and the second black stone has to be outside the centre 5×5 square. This opening has been shown to still favour black strongly, but it is implemented here as the default variant because it is playable for beginners.


Swap-2 is a modification to the original swap rule, where the first player makes the first three moves on the board (black, white, black), and the second player decides which colour to play. However, players could play balanced but very tricky openings that they have prepared for, and would have an advantage regardless of which colour they play.

In response to this, swap-2 was introduced, where instead of choosing a colour right after, the opponent is able to place the next two stones (white, black), and allow the initial first player to decide which colour to play. This makes it much harder to fully prepare for an opening.


Swap-5 is a mechanism to produce a fair 5-stone opening while still maintaining the feel of one-stone-per-move game. After the placement of every stone until the fifth stone, the opponent may pass to swap colours.

Until the fifth stone, the purpose of swapping colours is not actually to decide who will play each colour, but rather to yield the decision to place a stone to the opponent. If your opponent creates an opening that looks too imbalanced, and you do not see any good moves to balance the game, you may just keep swapping to allow the opponent to play out the remaining opening stones, and then decide which colour to play after the fifth stone. However, this runs the risk of the opponent playing out an opening that they have prepared for, so it is not recommended to swap colours more than twice in a row.


Ties are common among beginners when both players are not adapt at creating attacks, but it is less frequent among experienced players. Regardless, it does happen, and a proposed tiebreaker is the first player to pass wins if the result is normally a draw.


In Renju, in order to counter black's material advantage, some additional restrictions are placed on black, making it an asymmetrical game where white can win either by making a five-or-more-in-a-row, or by forcing black to create a restricted pattern:

  • Three-three restriction (double open three): black cannot make a placement at an intersection such that there are two directions where it can form an open four. An open four is a an unbroken line of four stones such that it can form a five-in-a-row in two ways.
  • Four-four restriction (double four): black cannot make a placement such that there are two four-in-a-rows such that it can form a five-in-a-row by adding a stone.
  • Overline restriction: black cannot make a placement such that there is a line of six or more stones in a row.

Black can usually only win by making a three-four threat, where there is an open three and a four, and white is not able to prevent the formation of an open four because the four has to be blocked.

In Abstract Play, these restricted moves are highlighted in the display by default to aid beginners, but you may turn it off in the display settings.

Historical note: Early Renju was played on a 19×19 board with only the three-three restriction and the overline restriction. The game on the 15×15 board and the four-four restriction was introduced later.

The pass tiebreaker has been tried for Renju in some places, and it is also given as an option here in Abstract Play.

Opening rules

The restrictions are meant to reduce black's advantage, but it was found that even with these restrictions, black still has too strong an advantage. Because of that, more opening rules have been introduced.

Traditionally, Renju is played such that the first stone is in the centre, the second is in the centre 3×3, and the third is in the centre 5×5, which results in 26 possible openings after removing symmetrical positions, and opening rules are designed such that these canonical openings can be played. There has been some recent attempts to allow more variation in the opening, like to allow the second stone to be in the 5×5, and the third to be in the 7×7. These are known as “super” variants, but they are not implemented in Abstract Play for the time being.

In the modern mainstream Renju scene, only two opening rules are used: Taraguchi-10 for correspondence play because of its simplicity, and Soosyrv-8 in tournaments because of its properties that make it similar to the traditional Renju opening rules. However, the popularity of Soosyrv-8 has been declining due to its complexity.

These opening rules make use of the nomination of something called tentative fifths. In order to reduce black's advantage, black has to nominate a number of intersections for the fifth move (third black stone). Then the player playing white will choose what they feel is the weakest nomination to place the black stone before placing a white stone. The game continues as usual from there. The number of tentative fifths depends on the opening rule, and in some of them, a player may select this tentative fifth count.

The default variant for Renju on Abstract Play is just a very basic unrestricted centre opening where black starts a the centre and the game begins. It is not playable competitively, but beginners will find it sufficiently challenging on both sides.

Swap-2 and Swap-5 are also enabled just in case there are Renju players that would like to explore unrestricted openings.


The Taraguchi-10 opening rule is a modification of the Tarannikov opening rule, with some adjustments to counter some niche exploits. In spite of its apparent complexity, it is actually the most beginner-friendly opening. If neither player swaps or invokes the 10-tentative-fifths rule (explained in a bit), the game just proceeds in a very simple and straightforward way that most players would come to expect.

In essesence, the Tarannikov opening rule is a variant of the swap-5 opening rule, but

  1. the first stone has to be placed in the centre,
  2. the second stone has to be placed in the centre 3×3,
  3. the third stone has to be placed in the centre 5×5,
  4. the fourth stone has to be placed in the centre 7×7, and
  5. the fifth stone has to be placed in the centre 9×9.

As with swap-5, players may elect to swap colours after every placement if they wish.

As it turns out, there has been some exploits by players where they would make very weak fourth-stone placements that are far away from the first three stones. The only balanced fifth stone would be at another weak position that is also far away from the first three stones, but it is not obvious where this position is, and neither would the follow up be trivial, so it is hard to play against someone who has explicitly prepared for such tricky openings.

In order to counter this, if a player makes a very suspiscious fourth move that is decidedly too weak, instead of placing the fifth stone or passing to allow that player to play their potentially well-prepared fifth move themselves, they may choose 10 tentative fifths (which is supposedly not hard to find for experienced players given how weak the fourth stone is), and the other player will not have the ability to swap. The number 10 was chosen because it strikes a balance between a sufficient number of variations without allowing fourth moves that are too unusual. Note especially that this option is only available for one player; if you choose to swap after the fourth stone, the opponent may not invoke the 10-tentative-fifths rule, so they may not abuse it to set you up with tricky tentative fifths.

In practice, this 10-tentative-fifths rule is very rarely invoked, and between players that are not deviously scheming for a surprise opening to catch their opponent off-guard, there will not be situations where it needs to be considered.

This is the most common opening rule that is used in serious online correspondence Renju games.

Full Taraguchi-10 rules


The RIF opening rule is the classic opening introduced by the Renju International Federation in 1995. After placement of the three stones, the second player may choose to play as black or white. After placement of the fourth stone, instead of directly placing the fifth stone, the player nominates two tentative fifths. The player playing white may then select the weaker of the two tentative fifths for the black placement, and then the game proceeds as normal with the placement of the sixth stone (white).

The RIF rule is a slight modification to the original swap opening from 1989, where the second stone is now also placed by the first player instead because there was supposedly a tendency for the second player to choose the indirect opening.

Full Classic rules


It was found that having two tentative fifths may not be sufficient for a lot of openings because black's position may still be very strong in both positions. The Yamaguchi opening is a variant where, after placing the first three stones, the first player must also declare the number of tentative fifths, and the game proceeds like the RIF opening, with the difference being that on the fifth move, the player that plays black will have to nominate the earlier declared number of tentative fifths. This allowed for a greater variety of balanced openings, and it was made the official tournament opening rule in 2007, replacing the RIF opening rule.

In the games database in, the highest number of tentative fifths declared was 12, so in Abstract Play, the first player may select from 1 to 12 tentative fifths.

Full Yamaguchi rules


The Yamaguchi opening did allow for more openings than RIF, but some of the openings where the third stone is very far away from the centre are still not playable. With the Soosõrv-8 rules, instead of having the number of tentative fifths declared by the first player on the first move, it would instead by declared by the player placing the fourth stone. They may declare from 1 to 8 tentative fifths, and the other player may swap colours if they wish. If the number of tentative fifths declared is too small, all of the tentative fifths chosen by the player playing black will be too strong; and conversely if the number is too large, the player playing white may choose a tentative fifth that is very weak.

It was found that by allowing up to 8 tentative fifths, all 26 canonical openings can be played in principle, and Soosyrv-8 has been the official tournement opening rule since 2015, replacing the Yamaguchi opening rule.

Full Soosyrv-8 rules


Pente is a variant of Gomoku that involves captures. You may capture by sandwiching a pair of your opponent's stones by flanking them on either side, removing them from the board. You win by either creating a five-in-a-row, or by capturing 5 pairs of your opponent's stones (10 stones). Note that by convention, white starts in Pente, but as usual, we use red and blue in Abstract Play.


There is an abundance of variants for Pente. An alternate description for some of these may be found on the official website.

Board size

Pente is tradionally played on a 19×19 board, but the 15×15 board is also provided as a variant.

Opening rules

By default, as with Gomoku, we use the Pro opening rules, but Swap-2 and Swap-5 are also available as alternatives for competitive play.

Capture rules

By default, captures can only be made by sandwiching two opponent's stones.

There is a variant called Keryo Pente that allows capture by also sandwiching three stones, and the capture-win threshold is raised to 15. This drastically changes the game is it makes it much harder to block threats. If this mode is enabled, the board will be tinted orange.

Self-capture rules

By default, nothing happens when you place your stone such that it becomes a pair of stones that are sandwiched by two opponent's stones.

In the Poof Pente variant, self capture is allowed, so placing your stone in that position will result in your own stones being removed, giving your opponent points. In theory, up to 5 stones can be self-captured in this way at once. The checks for captures and self-captures happen simultaneously, so in the situation where we have XO_XXO and the O player places in the black space, it will result in XO, and both players gain two points. In the rare event where both players reach the threshold score simultaneously, the game continues until there is a capture-count difference.

Overtime capture rules

By default, the game ends immediately once a line of five or more is formed.

In Boat Pente, or overtime capture, the creation of a line of five or more only puts the other player in check. The opponent has one move to make a capture to break the winning line. In most cases, the five-in-a-row can be reformed immediately after, but sometimes, it is possible to get a capture-win in this way.

Other variants

These variants are possible but are not currently implemented because I am still skeptical of their value, but they can be considered if there is sufficient demand for them.

Overline rules

By default, overline is a win, but there are also variants to forbid the creation of overlines or to make it ignored, as it is with Gomoku.

Note that if the overline-ignored variant is played, there could be instances where a capture results in the formation of the opponent's five-in-a-row, giving them a win. In the case where a capture also gives the player capturing a win (either by formation of their own-five-in-a-row or having collected 10 captures), it is a tie.

The overline-forbidden variant might give rise to interesting tactics, but it is still debatable if it should be enabled for both players or only black, as it is commonly used as a way to reduce the first player's advantage further.

The overline-ignored might be of historical interest because in the scacely-documented Ninuki-Renju rules (Renju plus Pente-style capture that was the predecessor to Pente), overlines are actually ignored.

Self-capture forbidden

In the some implementation of Pente, there is a variant to completely forbid placements such that it would result in self capture. This causes some differences in some edge cases, but fundamentally, it achieves the same effect as regular Poof pente. To reduce fragmentation, this variant is not enabled.

Renju restrictions

There has been discussions to enable Renju restrictions for Pente. Ninuki-Renju only describes three-three restrictions, but it is possible that it is because it was created before the four-four restrictions were introduced in Renju. Full Renju rules with Pente isn't likely to be well tested so it may or may not be balanced. There will also be some edge cases to work out, but until there are some very compelling arguments for this, Renju restrictions are not supported for now.


Connect6 is a N-in-a-row game that makes use of the 12* move protocol. Black places one stone, then white places two stones, then black places two stones, and so on. You win by forming a six-in-a-row of your colour. Overlines count as a win.

This game has been widely known for being a game that is balanced without the need for any particular opening rule, but strong players have claimed that Black still has some advantage at high-level play. Only a few openings are considered fair at high-level play, so some form of opening rule may be welcome to introduce a bit more variety to the game.

On Abstract Play, besides the traditional 19×19 board, we also have a Toroidal 15×15 board as a variant.

The default opening rule is a centre restriction is that the first player has to place their first stone in the centre as it is implemented in many other platforms, most likely because it is the strongest opening if there was no pie rule.

Opening rules

For competitive games, a swap-3rd opening rule is implemented. It allows for swap after the third move and goes like this:

  • The tentative first player places a stone in the centre
  • The tentative second player places two stones in the centre 5×5 region
  • The tentative first player places two stones anywhere on the board
  • The tentative second player may choose to play as black or white

The second move is restricted to the centre 5×5 region to constrain the number of opening positions to make it easier to study. This allows for 44 different second move openings after removing symmetrical positions, so in practice, after the third move, there is actually still quite a significant amount of opening variety.

The swap option is only given after the third move because swapping after the first stone is redundant as most players would rather place their favourite second move instead of yielding that decision to the opponent, and a swap option after the second move is also irrelevant because if your opponent chooses an opening, they would likely have studied for it, and there is no reason to allow them to continue to place a third move that they have prepared for.

Variant rulesets

There are some variants proposed by high-level player eeoo. A stone is collinear with another stone if it is in the same orthogonal or diagonal line as the other stone.

Collinear Connect6

In this variant, there are some move restrictions:

  1. The first stone must be collinear with one of the stones placed in the previous turn.
  2. The second stone must be collinear with the first stone.

Non-collinear Connect5

This variant actually also changes the winning condition to five-in-a-row, but it is implemented here because it is inspired by Connect6.

The reason why a six-in-a-row was needed to begin with was that placing two stones in a turn is too strong. This variant sees an alternative which is to restrict the stone placements such that they cannot be collinear with each other.

Four In A Row

Four In A Row is a modern classic where the goal is to get a four in a row. Because the number of pieces involved in the pattern is so small, some placement restrictions are necessary. In the classic game, gravity is used to restrict the possible placements: you may only place on spaces at the bottom row, or on spaces that are supported by at least one piece from below. Overlines are considered wins.

Parity considerations usually are important in the classic connect four game. On a board with an even number of spaces, the second player will be the last player to fill up the board at the top row. Since turns alternate, the second player should aim to make threats on spaces that are in odd rows counting from the top. Similarly, the first player would aim to make threats on spaces that are in even rows counting from the top.

The default board size is 8×8, but 10×10 is also available as a variant.

Swap-2 and Swap-5 are both enabled for this game.


There are a couple of variants that are implemented for Four In A Row.


The idea of making the game symmetrical so that the bottom edge isn't special has been around for a long time, but are actually a few different ways to extend this placement restriction such that the classic rules would be a special case of.


Because of how the physical game is usually constructed, it is likely that most people imagine pieces “dropping” from the edges onto an empty space. For the purpose of an extended version that retains the same feel of the original, it is actually more helpful to imagine pieces “growing” from the edges. In the edge-grow-4 variant, you may place a piece on the first empty space from any edge. This is a popular 4-side extension in online game platforms.

An “edge-drop-4” variant in which pieces “drop” from the edges is also interesting to think about, but it allows players to build on the sides of structures in the middle of the board, so the games end too quickly.


In the interior-gravity-4 variant, pieces appear from any internal space, and then slide towards the nearest edge until it reaches the first obstacle. If it's on a diagonal where it is equidistant from two edges, then it slides towards the nearest corner diagonally. This variant is known as Gravity.

This variant prevents towers from building up too high because every cell can only build on fixed edges, unlike the edge-grow-4 variant, so players are forced to play on all four sides.


With the clear variant, if there is a full row, it gets cleared and all pieces shift downwards. A four-in-a-row takes priority, so if the placement results in a win, then the game ends and the row is not cleared.

Together with the other placement variants, a full row or column at the edge will cause it to clear, shifting all pieces to the direction of the clear. It is possible to clear two rows at the same time if the clear is made from the corner, in which case pieces shift towards both directions.

Note that after a clear, it sometimes shifts the pieces into board configurations that are not normally feasible with just regular placement, but the behaviour is predictable.


Irensei is a combination of Go and Gomoku. Placement rules are exactly like Go, and groups of stones are removed when they are completely surrounded, but the objective is to make a seven in a row within the centre 15×15 region of the board. The two outer rows and columns cannot be used for a win, but sometimes placement is made there for making captures. Suicide placements are not allowed unless it results in a win, in which case the win takes priority.

In order to balance the game, an overline is a loss for black, but a win for white. The overline restriction includes stones on the edges, so any line that extends to the edges cannot be used as wining lines for black.

In addition to the basic opening, we also have swap-2 and swap-5 to increase the opening variety for advanced players.

n-in-a-row_games.txt · Last modified: 2024/05/03 19:34 by ypaul