How Diagrams Work

Keywords: SL description

This page describes how to create diagrams on Senseis' Library. To understand the information conveyed in the diagrams, see how to read diagrams instead.

A joseki variation

Diagrams make discussing Go much easier. Don't worry! They are quite easy to use.

SGF files are generated automatically from diagrams. Clicking on a diagram will download the corresponding SGF file. You may wish to examine some of these diagrams with your favorite SGF editor.

As you read these instructions, it will be helpful to open Edit page in a second window to see what's under the hood. Before closing it, please press cancel.

Basics

``` \$\$ A [joseki] variation
\$\$  ------------------
\$\$ | . . . . . . . . .
\$\$ | . . . . . . . . .
\$\$ | . . 7 3 X d . . .
\$\$ | . . O 1 O 6 . . .
\$\$ | . . 4 2 5 c . . .
\$\$ | . . 8 X a . . . .
\$\$ | . . . b . . . . .
\$\$ | . . . . . . . . .
\$\$ | . . . . . . . . .
```

The title of the diagram goes on the first line, separated from the dollar signs by a space (" ").

The rest of the lines describe the board. The syntax used is similar to that commonly used in newsgroups and email:

• A dot (".") is an empty intersection.
• "X" is a black stone and "O" is a white stone.
• A comma (",") is a hoshi (star point).
• Edges are marked with any of "|", "+" and "-".

Moves

You can represent a sequence of moves with the numbers 1-9 and 0 (0 represents move 10). You can only have ten moves (1 through 10) in one diagram[3].

By default, move 1 and all odd-numbered moves are black, and all even-numbered moves are white. You can reverse this by putting "W" after the dollar signs on the first line: "\$\$W". Using "B" makes explicit the default behavior of Black going first. Think of a line beginning with "\$\$B" as meaning "Black to play."

Black to play
White to play
Ko (5 at 1, 8 at 2)

If two moves are made at the same intersection, put the second move in the diagram's title in the form "a at b" (for example, "5 at 1"). This causes the move to be included in the generated SGF file.

Move numbering starts at 67

You can also start the move numbering at something other than 1 by adding 'mX' (X being the starting move number) to the first line. The first line for this diagram reads "\$\$Wm67 title text". Beware: this feature does not work in preview mode.

Although the stones show at most two digits, you can put higher numbers there too. E.g. "\$\$Wm141" let's the moves start at '41'. You should use the correct move number whenever possible, even though only the last two digits are shown in the diagram.

Markup

Diagrams can contain markup, and then be referred to in the text:

Board markup

```   In      In     Appears     Meaning
Diagram  Text      as
--------------------------------------------------------
X       BO            plain black stone
O       WO            plain white stone
1..9     B1,W2    ,   Black's move 1, White's move 2 [3]
0 (zero) B10,W10  ,   Black's or White's move 10 [3]
-     B11-B100  -  Black's or White's move 11-100
B       BC            black stone with circle
W       WC            white stone with circle
#       BS            black stone with square
@       WS            white stone with square
Y       BT            black stone with triangle
Q       WT            white stone with triangle
Z       BX            black stone with cross mark (X)
P       WX            white stone with cross mark (X)
C       EC            circle on empty intersection
S       ES            square on empty intersection
T       ET            triangle on empty intersection
M       EX            cross mark (X) on empty intersection
a..z     a..z     a..z    letter on empty intersection
```

Coordinate markers and board size

You can cause a diagram to show coordinate markers by putting "c" after the dollar signs on the first line: "\$\$c". The "c" must follow the color indicator ("B" or "W"), if present: "\$\$Bc".

The diagram must show at least two perpendicular edges for the coordinate markers to appear.

There are other coordinate systems. But only the style A1 is supported here.

Nadare joseki on a small board

If the diagram shows an entire board (that is, it shows all four edges), then its size will be calculated automatically. You can specify a size for a partial board by placing it after the dollar signs on the first line: "\$\$13". The size must follow the color indicator and "c", if present: "\$\$B13", "\$\$c13" or "\$\$Bc13". Without an explicit size, a partial board will be assumed to be 19x19.

Note that the coordinate markers on the left of the example diagram go to 13 rather than 19.

Syntax:

``` \$\$ [ MarkupCharacter | PageName ]
```

Just add lines like the upper one at the bottom of a diagram to create a link between a marked stone/point and a page.

MarkupCharacter
is the same character used on the board itself.
PageName
is any name, external link, or local name.

[2] Examples:

The following diagram contains three examples for links. It is the result of the code to the right.

``` \$\$ Links in diagrams - examples
\$\$  --------------
\$\$ | . . . . . . .
\$\$ | . C . . . . .
\$\$ | . . . 1 6 . .
\$\$ | . . 5 4 . . .
\$\$ | . . 3 2 . . .
\$\$ | . . a . . C .
\$\$ | . . . . . . .
\$\$ [a|http://gtl.xmp.net/members/info?p_key=349] [22]
\$\$ [C|#1] [23]
```

[22] links a to Arno's GTL info.
[23] links all the circled points to the footnote called [#1].

Works with every kind of markup and with marked stones. Does not work with plain stones or on the empty board.

Lines and Arrows

You can draw lines and arrows on the board as well:

Example: using arrows to show influence

As it is hard to visualize and edit such lines in edit mode, lines and arrows are specified in extra lines - usually after the diagram. The code for the above diagram looks like this:

``` \$\$ {AR C14 C11}
\$\$ {AR 5:6 5:9}
```

The syntax basically is "\$\$ {command point1 point2}". Command can be either AR for arrows or LN for lines. Coordinates can be given in two different ways:

board coordinates
this is the usual Go coordinate system. Points are denoted as A1 .. T19. For this to work the diagram has to be anchored in at least one corner, i.e. center diagrams cannot use this method. Basically, if you can switch on coordinates with the \$\$c option then this method works.
absolute coordinates
points are denoted in 'X:Y' syntax. X and Y are a coordinate system with the root being in the upper left - numbering starts at 1:1. The second arrow in the example uses this system. These coordinates will always work, as they do not rely on borders and corners.

Comparison diagrams

Example

Use _ to make separator in the diagram. Press "edit page" button to look in details.

Stones in Text

In text, you can refer to stones like this:

B1, W2 ... B99, W100, BC, BS, BT, BX, BO, WC, WS, WT, WX, WO, ES, EC, ET, EX

This will appear like this:

, ... , , , , , , , , , , , , , , ,

You can suppress the special meaning of these words by preceeding them with an exclamation mark: i.e. !BC gives BC.

Inlining thumbnail diagrams

You can inline thumbnail diagrams from other pages, by adding :i in the link. E.g. [!33PointInvasion:i] results in the diagram on the left. If no number is given after :i the first diagram of that page is inlined.
You can also set a text to name the link.
By adding a number like :i3 you can inline a specific diagram in that page, e.g. the third diagram of the same page referenced as [!33PointInvasion:i3] gives the diagram on the left.
You can even make much more, like linking to pages with a thumbnail taken from another page etc. For such special issues look at Special Templates / Image.

If you click on the thumbnail you are taken to the right position in the page.

Note: thumbnails have a size of about 7kb (corner) to 25kb (19x19 board middle game). Avoid inlining more than 50 thumbnail diagrams from other pages, otherwise the page download size may easily exceed 1MB. If you have an index page, break it up into subpages with 50 thumbnails each at most.

Summary of options for the first line

The first line controls the behavior of the diagram. The basic syntax is:

``` \$\$(B,W)(c)(size)(m Num)(title)
|    |  |     |      +----> title of the diagram
|    |  |     +-----> starting move number (e.g m67 - no space!)
|    |  +----> board size (for SGF and coordinates - default:19)
|    +-> enable and show coordinates in the diagram image
+--> first move is either by black (B) or white (W)
```

All parts are optional and can be omitted.

Force text below a diagram

4 percent signs (%) force a text to appear below a diagram

diagram code

Text beginning in a new line

Other information

Diagrams that are shown when previewing edits look different from the normal diagrams you see in pages. See on-the-fly diagram.

Sensei's Library has a tool that generates a diagram from an SGF file. (A link to the tool is also given when you edit a page).

In order to set up a game position yourself, you may copy the diagram from the bottom of any edit page, or at Corner diagram for a corner position.

For odd board shapes, look at Creating Irregular Gobans With Wiki.

There are some extensions to diagram syntax for the sake of pattern search.

Utilities

• Kombilo also has a feature which allows diagram export for SL. Choose File > Export Current Position > Wiki Mode (check box).
This directly produces diagrams in SL format.
• Quarry can export diagrams for use at SL or GoDiscussions.com, as well as a plain ASCII export. File > Export has both options.
• Drago allows the user to select a rectangular area on the go board and export it to some formats including SL ASCII format, see SL Diagrams with Drago.
• GOWrite allows the user to select a rectangular area on the go board and export it as SL syntax. This functionality is accessed through Edit > Copy Wizard.
• SmartGo can export diagrams to ASCII format: Choose Edit > Copy as ASCII to create a diagram of the current board position. Choose Tools > Options > Edit and turn on Wiki format to produce the correct format for Sensei's Library. Choose View > Partial Board to select a rectangular area of the board.
• DragonGoServer has a Goban-Editor, that uses the Sensei's Library style diagram format to form setups for shape-games or to be used inline for the DGS-forums. Diagrams can be created from DGS-games, uploaded from a SGF or created from scratch or copied from SL and previewed while changing it. Regular boards with most of the SL-diagram-features are supported.
• Go4Go can export diagrams directly from its online SGF viewer to set up positions in professional games.

Discussion

If you are in edit-mode and scroll down the window you will see that we have put two diagrams there for you to copy & paste. Also, there's a quick help included as well. Any questions left?

Yes: I want an easy way to force a second diagram beside a first one (so to say 'on the same line'). No, the method in the chapter "Comparison diagrams" is too complicated.

For this, you can use tables. Because tables use a template, you shouldn't use the | character, but use the - character instead as a left/right border. For an example, see Leather Scroll Problem 49/ Attempts and edit the page.

[1] - This is the footnote referred to in the example diagram above [2].

[3] - Sorry! 10 moves ( 1 .. 0 become 1 through 10) is the maximum in one diagram. Inserting other numbers will not work. If you want a diagram with more than 10 moves in it, you can use a self made image hosted on another site (see how to add images) or use several diagrams, splitting the moves through them (See Ongoing Game 1 for an example).