[SGF FF[4] - Smart Game Format]

Twixt (GM[21])

Implementation of SGF FF[4] for Twixt

These specifications are intended as a standard for game and puzzle files used by Twixt programs.

The rules for Twixt can be found here. It should be noted that the different move syntax recommended there was intended initially for the PBMserv email server, which originally did not have a graphic user interface for Twixt. This new syntax is easier for a GUI to deal with, and is perhaps more readable by humans as well.

All (game-specific) property values are case insensitive.

The default board size is 24 x 24. The minimum number of rows or columns is 3, and the maximum 702. If a board is asymmetric (handicap game), the SZ property should specify [number_of_columns : number_of_rows] in line with the SGF FF[4] specification. If a non-square grid is specified for a game file, then the HA property should also appear in that file (see below.)

White tries to connect the top and bottom of the board; Black tries to connect the left and right sides.

The default first player is White. The default RU (Ruleset) value is "STD" (see below.)

Point and Move types


[ board ]

Holes on the board are labeled with letters for the columns and numbers for the rows, as shown. A cell is identified by the letter of its column, followed by the number of its row. Examples: [a3], [G5], [D11], [j10]. If more than 26 columns are used, then the form letter letter number is used. After Z comes AA, then AB, AC, etc.

Besides the grid of holes, there are two grids for the link centers. The shallow link grid contains the centers of links with shallow slope. Each link center point is the center of two distinct possible links. For example, a link from B2 to D3 has the same center as a link from D2 to B3. Shallow link coordinates have the form letter number * where the * indicates a position halfway between the hole row indicated by the number and the next hole row. For example, the link from B2 to D3 has C2* as its center. Similarly, steep link coordinates are of the form letter * number. For example, the center of a link from B2 to C4 is at B*3.


There are four types of normal moves:

Although this syntax places no restriction on the order in which these move types are made, a suggested convention for game files, when more than one move type is made by a player as part of the same turn, is to place a new peg as the final step. One possible drawback to this convention is that players would not be able to refrain from adding all legal links to the peg just placed. But since links may be removed on a subsequent move, this should make no practical difference in terms of game play. It may be more convenient to allow link removal moves after the new peg is placed, when using moves to set up a puzzle initial position.

Here is an example of a move sequence where links are rearranged. White is to move:

[ before ]

After the sequence ;W[-F6*][-G*7][-H6*][-i*6][+i6][G7] the board looks like this, with Black to move:

[ after ]

Moves should be legal; there is no defined behaviour upon reading an illegal move, except to display an error message.

The following moves are special:

Both swap methods are equivalent in play terms, although the resulting move coordinates are mirror images of each other. A swap move may occur only on the second turn. Neither type of swap move should occur in a handicap game. The ruleset value does not necessarily indicate which type of swap is used, since the difference pertains to how the game is displayed, not the actual game position.

Example special moves: W[resign], B[swap-pieces], B[forfeit].


Property:      RU
Propvalue:     SimpleText
Propertytype:  game-info
Function:      This indicates what ruleset was used in the game. This is not
               specific to Twixt, but the values are.
               "STD"      Standard. Alex Randolph's original ruleset. You may remove and
                	  add your links as much as you wish during your turn. This is
                	  the default value.
               "PP"       Paper and pencil. This version is used on the Little Golem
                	  server. Links are not removed, but your own links may cross
                	  each other. This may result in a winning path which loops
                	  across itself.
               "3M"       Early 3M sets not only ignored link removal, but even worse,
                	  they left out any mention of swap. Very few such game records
                	  are known.
               "Twixteus" This is the name of a Twixt database program for the Atari ST.
                	  It has a significant database of games, which apparently were
                	  played by mail. The players agreed to restrictions on how you
                	  may add links other than to the peg just placed. Links may be
                	  removed as desired, but in order to link two pegs already on
                	  the board which were not linked, you must spend a turn to
                	  remove one of the pegs and place it back in the same spot.

Property:      VW
Propvalue:     elist of point
Propertytype:  misc
Function:      View only the listed holes. See the FF[4] property list
               for details. This is also not specific to Twixt, but
               it should be mentioned that this property is useful for
               puzzles which are set up on some portion of the board.
               For example, the Randolph series of 40 puzzles would
               use "VW[A1:L12]" to define the Northwest quarter-board.


Property:      N
Propvalue:     SimpleText
Propertytype:  node-annotation
Function:      Name of a specific node in the game tree. This is also not
               specific to Twixt, but the following convention is suggested:
               If the value of N is "bookmark X" where X is some number, then
               this node could be a labeled bookmark, which could be quickly
               accessed by some application. There should not be two bookmarks
               in the same file with the same value of X.
               It is also recommended that X stay in the range 1 to 9.
               Bookmarks are intended for the end user, and are unlikely to
               appear in any archive file for the public.
               The HO[] property is also useful for indicating important nodes
               in the game, although bookmarks need not be important.

Property:      IP
Propvalue:     SimpleText
Propertytype:  node-annotation
Function:      Designates the initial position that the viewer should
               display. It will most frequently indicate the current position of
               play in the game. This is necessary because future possible moves
               may have been explored, and the user must be able to distinguish
               real moves actually made from exploratory moves. For puzzle files,
               an IP property indicates the puzzle initial position. More than one
               IP property in a game is illegal, and the behaviour undefined.
               The property value should be empty []; it is specified as
               SimpleText for compatibility.

Property:      HA
Propvalue:     SimpleText
Propertytype:  game-info
Function:      This indicates a handicap game. The value is always empty.
               The size of the handicap is indicated by the SZ property.
               HA has the effect of disallowing the possibility of swap. Typically
               White receives the handicap, so the number of columns is equal to or
               greater than the number of rows. If the grid is square, that is
               called move handicap. Black does not usually receive a row handicap
               because the advantage of the first move is so strong, it may not be
               clear who is giving whom a handicap.

Property:      PZ
Propvalue:     SimpleText
Propertytype:  game-info
Function:      Puzzle flag, if the file is for a puzzle instead of a game.
               (It could also be used in a file which is not a puzzle,
               but which is used as an example or to illustrate something.)
               The GN property would provide the name for this puzzle.
               Puzzle files should have an IP property in them somewhere.
               They should also have a PL property in the game-info node.
               PZ has the effect of relaxing the convention that turns involving
               link rearrangement should end with the peg placement move, for
               moves prior to the IP property. It also relaxes the restriction on
               turn order; White or Black may take any number of turns in a row
               prior to the IP.
               The value specifies what the Goal of the puzzle is. If the value is
               empty [], then the default is the player to move (specified by PL) is
               to win. Values are the same as for RE:
               "0" or "draw" if the player to move is to force a draw,
               "B+" if Black is to win, and
               "W+" if White is to win.

Twixt fanatic homepage.

For more information contact David J Bush, < twixt at cstone.net >