User Name: Password:
New User Registration
Moderator: hexkid 
 Go

Discuss about the game of Go or find new opponents.

Beginners:
This TUTORIAL will help you to learn the rules & basics.

More information about Go: senseis library
There is a fellowship dedicated to the game of Go.


Messages per page:
List of discussion boards
You are not allowed to post messages to this board. Minimum level of membership required for posting on this board is Brain Pawn.
Mode: Everyone can post
Search in posts:  

24. September 2006, 02:46:57
ikkentobi 
Subject: Create SGF files
Hi Go lovers,

I always wanted to save my brainking Go games as SGF files so I wrote a small program which make that possible.
For download and instructions go to:
http://www.tobias-nagel.nl/public/SGF-Creator.htm

greets
Tobias

24. September 2006, 08:51:21
jurek 
Subject: Re: Create SGF files
ikkentobi: That's great :D
Now if only Fencer would provide a link to download SGF notation, just like he has for PGN for chess games, then we'd be set!

25. September 2006, 11:16:56
Fencer 
Subject: Re: Create SGF files
ikkentobi: It doesn't work for me. Each time I copy and paste the moves, it shows an error message that something is wrong with the move list.
Anyway, I just wanted to use it to generate a sample SGF file because I didn't fully understand the format description. Can you provide a sample game please?

25. September 2006, 11:48:17
hexkid 
Subject: Re: Create SGF files
Fencer: I wrote a script to transform the move list into an SGF file. It needs a few twists, but as I don't use it often, I haven't twisted it. You can see the PHP source or use it to convert any public game to SGF by going to http://hexkid.info/BK/ParseGame.php?g=##### where ##### is the game number.

I've also integrated this functionality into BrainKing itself with the help of a Greasemonkey script, accessible at the user scripting fellowship :)

25. September 2006, 14:37:04
ikkentobi 
Subject: Re: Create SGF files
Fencer: Here is an example:

(;SZ[19]HA[0]KM[5.5]
PB[Ceiter]
PW[ikkentobi]
;B[dp];W[pd]
;B[cd];W[pq]
;B[ec];W[cj]
;B[ch];W[cm]
;B[co];W[jq]
;B[qf];W[pi]
;B[qc];W[qd]
;B[pc];W[od]
;B[rd];W[re]
)


The file on top was created with my proggy.

(; - it starts with an open bracket and a semicolon

SZ - Bordsize
HA - Handicap
KM - Komi
PB - Black Players Name
PW - White Players Name

After the game properties comes the move list.
Every move is seperated by a semicolon.
You could write:

;B[dp]
;W[pd]
;etc.

B stands for Black, W for white
The small letters are the bord coordinates:
aa would be the upper left corner and
ss the lower right on a 19x19 bord.

) - the file ends with a closing bracket

For more information see:
http://www.red-bean.com/sgf/

26. September 2006, 20:57:07
Fencer 
Subject: Re: Create SGF files
ikkentobi: Looks good, thank you :-)

1. October 2006, 22:06:54
ikkentobi 
Subject: Re: Create SGF files
Fencer: Thanx for putting the SGF link. Its a good start but up to now it seems that the code doesn't take care of the changing coordinates directions at BK. So some games are ok, others are mirrored or rotated (actually I don't know why BK does this swapping of coordinate directions).
Like it is now you cannot simply bind the SGF to the coordinates in BK.

Another wish: it would be great to include the players names in the SGF file name.

thx
Tobias

2. October 2006, 20:18:06
Fencer 
Subject: Re: Create SGF files
ikkentobi: Mmmm, I don't fully understand what you mean about the coordinates. Please give me an example of a game which generates wrong SGF file and why.
Player names are included. PB and PW tags.

3. October 2006, 21:55:17
ikkentobi 
Subject: Re: Create SGF files
Fencer: Here ya go:
Game 1: Go (Ceiter vs. ikkentobi) - on my screen this game has A1 in the upper right corner. The resulting BK-SGF is vertically mirrored.

Game 2: Go (ikkentobi vs. stiveletti) - This is an iteresting example. First of all this one throughs an error "Invalid board location "pass" on line 134". Pass should be an empty node like ;B[] or a tt like ;B[tt].
Back to the coordinates. In this game A1 is on my screen at the lower left corner which is right. But the resulting BK-SGF is horizontal mirrored.

FYI:
All SGF-editors that I know have A1 at the lower left corner!
The SGF notation has [aa] at the upper left corner (see http://www.red-bean.com/sgf/go.html)
That means a black move shown by a SGF-editor at A1 should be written ;B[as]

Hope that helps
Tobias

3. October 2006, 22:09:19
jurek 
Subject: Re: Create SGF files
Fencer: I think there are two different issues here.

The first is that the board orientation is different based on being black or white. For most games on this site (chess, checkers, backgammon, etc), board orientation is of prime importance, but for games like go, it is mostly irrelevant to the game. Most SGF viewers have 1A on the lower left-hand corner. This would account for the rotating that ikkentobi is seeing. Personally, I really don't mind, and I don't see this as a problem.

The second is slightly goofy.
This site has a very good run-down of the SGF file format:
http://www.red-bean.com/sgf/
In particular, this page: http://www.red-bean.com/sgf/go.html
has listed the directionality of the axes slightly different. "aa" is displayed as the upper-left corner of the board (even though that corresponds to 13a or 19a or 9a, depending on the board size) and then continues across and down. So in essence, the vertical number column is inverted, with regards to how it's displayed (a=19, b=18, ..., s=1). This discrepancy would account for the mirroring that ikkentobi is seeing. Again, this isn't *that* big of an issue, but it is inconsistent with the SGF spec.


I also have a wishlist pertaining to the end of the game :)

When the final + move is made and the game is over, the SGF file can have some added tokens to properly show the score. These tokens TW and TB are used to indicate white's and black's (respectively) territory. This also automatically marks dead stones, so nothing extra is needed for that.
The syntax is (as poorly described on http://www.red-bean.com/sgf/go.html): TW[point1][point2][point3]...[point4]
and doesn't include the player's own played stones.
For example, in this game: Go 9x9 (JB007 vs. tenuki)
The output would be:
TW[aa][ba][ca][bb][cb][ac][bc][ad][af][bf][ag][bg][ah][bh][ai][bi][ci][di]
TB[fa][ga][ha][ia][fb][gb][hb][ib][fc][gc][hc][ic][hd][id][he][ie][hf][if][ig]

Date and time
Friends online
Favourite boards
Fellowships
Tip of the day
Copyright © 2002 - 2024 Filip Rachunek, all rights reserved.
Back to the top