Convert this
. . . . . . . . .
. . . . . . . . .
. . . 6 5 1 . . .
. . . X . 2 3 . .
. . . . . 4 . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . X)+ . . . . .
to this








followed by the SGF representation of the position.

Presentation of ascii Go diagrams


Contents

Introduction

Here is a Go diagram using ascii:

. . o # o # # # o
# o o # o . # . o
# # . # o o o o o
# # # # # # # # #
# # o o o o o o o
# o . . . . . . .
# o . o . . . o .
# o . . . . . . .
# o . . . . . . .
It is readable, but not attractive. If you have either
    an ascii Go diagram
or
    the URL of a page which contains one or more <goban>-delimited ascii Go diagrams
you can use this page to convert it so that it looks like this:









followed by the SGF representation of the position:

(;GM[1]
FF[4]
AP[go-utils.pl:1.6]
US[Toni Cornelissen (toni@dse.nl)]
SZ[9]
;AB[da][fa][ga][ha][ab][db][gb][ac][bc][dc][ad][bd][cd][dd][ed][fd][gd][hd][id][ae][be][af][ag][ah][ai]AW[ca][ea][ia][bb][cb][eb][ib][ec][fc][gc][hc][ic][ce][de][ee][fe][ge][he][ie][bf][bg][dg][hg][bh][bi]
PL[]
)

Diagram conversion

Edges:
top
left right
      bottom
Coordinates:
top
left right
      bottom

Paste or type an ascii diagram in this box:

To play: (colour for odd-numbered stones) Black White
Stone size:
  Pixels Artist
15 – transparent Andrew Grant & Nick Wedd
15 – white Andrew Grant
19 – white "
27 – white "
39 – white "
55 – white "

How to prepare diagrams for conversion

A diagram looking like this:
>> . X .    This is a comment
>> . X .
>> . O\O
is converted to one like this:



The symbols you can use are
symbolmeaning
.
X   x   #
O   o   0
,   +   *
O<   O]   O)   O\
#<   #]   #)   #\
.<   .]   .)   .\
17
18
a   b   c   P   Q   R
The close-bracket characters > ] ) \ must be immediately followed by the next character, with no intervening space.

There are controls to decide:

Within the diagram, line ends denote ends of lines, so you should avoid blank lines.

Page conversion

A general link to any page with <goban> tags, using the "post" method.
URL to display:
Stone size:
  Pixels Artist
15 — transparent Andrew Grant & Nick Wedd
15 — white Andrew Grant
19 — white "
27 — white "
39 — white "
55 — white "
user-specified below
Images to use:
Specify the URL of a directory of suitable images. Include the final /.
Possibilities which you can cut and paste to test this (the scond one is to test the addition of coordinates):

How to write a page suitable for conversion

Go diagrams on your page should look like this:
<pre><goban edges=lbr>
 . . . . . . . . . . . . . . . . . . .
 . . . . . . . o o o o o o . . . . . .
 . . . , . . o . . , . . . o . , . . .
 . . o o o . o x x x x x x o . o o o .
 . o . . . . o x . o o o x o . . . . .
 . . x x x x x o o . . o o x x x x x .
</goban></pre>
which will be converted to look like this:






The arguments to the goban tag are all optional. They decide:

The symbols you can use in the diagram are listed above.

Within the diagram, line ends denote ends of lines, so you should avoid blank lines.

Some example <goban> tags are:

    <goban>
The default. No edges on the board. Uses Nick's gif set.

    <goban edges=lbrt size=15>
An edge round the board. Uses Andrew's 15x15 gif set.

    <goban edges=lt size=39 pl=w>
Top left corner of a board. Uses Andrew's 39x39 gif set. Odd-numbered stones are white, even black.

    <goban edges=lt images=http://www.weddslist.com/g/39/ pl=w>
Same effect as above.

How to link to such pages

If you would normally link to a page like this:
<a href="http://www.maproom.co.uk/thousand.html">link</a>
you can instead give a link which uses the script (implicitly using the "get" method), like this
<a href="http://www.weddslist.com/cgi-bin/goban.pl?url=http://www.maproom.co.uk/thousand.html">link</a>
(Note the confusing combination of single and double quotation marks, used by an old version of the script, is no longer necessary.

If you would normally link to a page with an anchor like this:
<a href="http://www.foo.com/bar.html#baz">link</a>
you can instead give a link which uses the script (using the "get" method), like this
<a href="http://www.weddslist.com/cgi-bin/goban.pl?url=http://www.foo.com/bar.html#baz">link</a>

For some servers it may be possible to omit some of the quotation marks. For others, the exact use of '' and "", with the "" within the '', is necessary. I know that it is not possible for this to be server-dependent – I am telling it to you because I have found it to be true, not because it makes any sense.

Source of scripts

The scripts themselves are available, under the terms of the GNU General Public License: or download them all at once as all.zip

Feedback

Any comments or suggestions should be sent to the maintainer of this page, Nick Wedd.

Credits

The original idea of a cgi script to present go positions nicely was due to Nick Wedd. He presented this idea, and a prototype, in rec.games.go.

This idea was taken up by Toni Cornelissen. He rewrote the scripts, making them more robust and more flexible, and adding many new features, including SGDF output. Nick then copied Toni's scripts and made minor changes which he thought were improvements.

A few of the graphics, the twelve basic ones in the "Andrew Grant & Nick Wedd" gif set, were created by Nick Wedd. All the graphics in the "Andrew Grant" gif sets were created by Andrew Grant. Nick took most of the graphics from Andrew's 15x15 gif set, added transparency to them, and put them with his own gif set.

Alternatives

If you find that the methods described on this page for presenting a Go diagram are not suitable, some other methods are described here.

Among these, my own preference is for Simon Goss's program GoFigs.

Weddslist index page
Nick Wedd's home page