SGF file format FF[5] last updated: 1999-03-19

`Move' vs. `Add Stones'

SGF provides two ways to add new stones to the board: We are going to have a closer look at both and explain the definition using examples.

How to execute `Add Stone'

From the specification:
Add (resp. clear) black/white stones to the board. This can be used to set up positions or problems. Adding (resp. clearing) is done by 'overwriting' the given point with black/white/empty stones. It doesn't matter what was there before. Adding a stone must not trigger any rule specific actions, e.g. in Go GM[1]: no prisoners nor any other captures (e.g. suicide). Thus it's possible to create illegal board positions.

Note: Illegal positions remain on the board. I.e. when stepping to the next node breathless stones remain on the board. Unless, of course, they get captured by an adjacent move, or overwritten by another `Add Stone' command.

If your application can't handle illegal positions (e.g. a computer player or scoring algorithm) then it should display a message to the user. The message could state, that from now on (due to the illegal position) certain features (e.g. scoring) are no longer available. Or it could state, that it had to stop at the node before. Your application must not remove breathless stones automatically.

How to execute a move

From the specification for GO GM[1] (The different steps are numbered):
How to execute a move
  1. When a B (resp. W) property is encountered, a stone of that color is placed on the given position (no matter what was there before).
  2. Then the application should check any W (resp. B) groups that are adjacent to the stone just placed. If they have no liberties they should be removed and the prisoner count increased accordingly.
  3. Then, the B (resp. W) group that the played stone belongs to should be checked for liberties, and if it has no liberties, it should be removed (suicide) and the prisoner count increased accordingly.
  4. Lastely, the move number should be increased by one.

Ad 2): Only adjacent points are checked. Other breathless stones are not removed.

Examples

PhaseB move at D3B move at D4W move at d4
0

Initial position

1

Overwrite

2

Check for capture

3

Check for suicide

4

Final position


One W stone captured

One W stone captured

Two W stones captured
Note: In the above examples only empty points were overwritten in phase one. As the specification says, the point gets overwritten, no matter what was there before. Therefore, the following initial positions would have exactly the same outcome.
PhaseB move at D3B move at D4W move at d4
0

Initial position

1

Overwrite


B move overwrites W stone (no prisoners taken)

B move overwrites W stone (no prisoners taken)

W move overwrites W stone (no prisoners taken)

More Examples

Let's have a look at the following SGF file:
Note: AB[bb:ee] is the compressed form of AB[bb][bc][bd][be][cb][cc][cd][ce][db][dc][dd][de][eb][ec][ed][ee]
(;FF[5]GM[1]SZ[6]
  AB[bb:ee]
 ;AW[bb][ee][dc][cd]
 ;AW[cb][bc][be][eb][ed][de]
 ;AE[dc][cd]
)

Node 0Node 1Node 2Node 3
AB[bb:ee]AW[bb][ee][dc][cd] AW[cb][bc][be][eb][ed][de]AE[dc][cd]
Black stones are added to the board White stones are added to the board. Note: no captures. This creates an illegal position. White stones are added to the board. Note: no captures. The illegal position from the previous node remains on the board. Stones are cleared from the board. Note: no prisoners taken.

Another example:

(;FF[5]GM[1]SZ[6]
  AB[bb:ee]AW[bb][ee][dc][cd][cb][bc][be][eb][ed][de]
 ;B[dd]
)
Node 0
Node 1 phase 1
Node 1 phase 2Node 1 phase 3 Node 1 phase 4
B and W stones are added to the board. No captures. This creates an illegal position. Phase 1 of executing B[dd]: overwrite position. Check for capture. Two W stones are captured. Check for suicide. Final position. Two W prisoners taken.

Another example:

(;FF[5]GM[1]SZ[6]
  AB[cb][bc][cc][dc][cd]
 ;W[cc]
)
Node 0Node 1 phase 1Node 1 phase 2Node 1 phase 3 Node 1 phase 4
B stones are added to the board. Overwrite position. No prisoners taken. Check for capture. Check for suicide. One W stone captured. Final position. One W prisoners taken.