Page 1 of 1
How to transform bunch of 13x13 SGFs into 19x19
Posted: Tue Oct 21, 2014 8:32 pm
by kupus
Hi,
I have a bunch of (problem) SGFs done on 13x3 board and they should be 19x19.
Is there an app that can transform them from 13x13 to 19x19, fast and easy way (like, bulk option)?
Many thanks
Posted: Tue Oct 21, 2014 9:05 pm
by EdLee
Hi kupus, I don't know of any Go app that can do this in bulk.
If you're on Unix or some other OS, you may be able to write
a simple script to replace all the SZ[13] in the SGF to SZ[19] --
I think that may do it. Maybe there are freeware apps for
all the popular platforms that do this simple ASCII text substitution.
Curious: if all the problems fit on 13x13, why move to 19x19 ?
( I can imagine trying to save toner ink for all the

stones. )
Good luck.
Re: How to transform bunch of 13x13 SGFs into 19x19
Posted: Tue Oct 21, 2014 11:29 pm
by oca
Hi kupus,
Edlee's proposition to change the SZ attribute will work if your problems are in the lower left corner. if not, like this for example :
$$Bc13 Black to kill
$$ ----------------+
$$ . . . . . . . . |
$$ . . . . . . . . |
$$ . . . . . X O . |
$$ . . . . , . X . |
$$ . . . . . . . . |
$$ . . . . . . . . |
$$ . , . . . . . . |
- Click Here To Show Diagram Code
[go]$$Bc13 Black to kill
$$ ----------------+
$$ . . . . . . . . |
$$ . . . . . . . . |
$$ . . . . . X O . |
$$ . . . . , . X . |
$$ . . . . . . . . |
$$ . . . . . . . . |
$$ . , . . . . . . |[/go]
you will need to fix the moves too...
Re: How to transform bunch of 13x13 SGFs into 19x19
Posted: Wed Oct 22, 2014 1:00 am
by RobertJasiek
1) Use a software or text editor with replacement or regular expressions capability applied to all files in a directory (tree). Replace SZ[13] by SZ[19].
2) Open each file in a go editor (such as GoWrite), mark a region and shift that region.
I do not know if there is a simpler way for (2), but you might wish to check every SGF anyway, because some configurations you might want to leave in the corner, others move to the center.
Re: How to transform bunch of 13x13 SGFs into 19x19
Posted: Wed Oct 22, 2014 11:19 am
by kupus
Thank you all for your input.
The reason for changing from 13x13 to 19x19 is -
I have bunch of problems (lower left corner) that I want to export to doc/pdf using Drago. Then, if 13x13 is used hoshis are not in the proper place (as for 19x19 board). I can either
a) dont pay attention to hoshis
b) export without hoshis
I played with renaming *.sgf -> *.txt, then renaming sz[13] -> sz[19] with TextCrawler, but then stones are shifted up, they are not in the lower right corner.
So looks to me that there is no easy fix.
Thanks again, much appreciated
Re: How to transform bunch of 13x13 SGFs into 19x19
Posted: Wed Oct 22, 2014 1:46 pm
by oca
kupus wrote:Thank you all for your input.
The reason for changing from 13x13 to 19x19 is -
I have bunch of problems (lower left corner) that I want to export to doc/pdf using Drago. Then, if 13x13 is used hoshis are not in the proper place (as for 19x19 board). I can either
a) dont pay attention to hoshis
b) export without hoshis
I played with renaming *.sgf -> *.txt, then renaming sz[13] -> sz[19] with TextCrawler, but then stones are shifted up, they are not in the lower right corner.
So looks to me that there is no easy fix.
Thanks again, much appreciated
I think I can help you. could you post a sample sgf ?
I can write transformation the script for you.
Re: How to transform bunch of 13x13 SGFs into 19x19
Posted: Thu Oct 23, 2014 11:12 am
by kupus
Thanks oca, just sent you a PM
Re: How to transform bunch of 13x13 SGFs into 19x19
Posted: Thu Oct 23, 2014 11:47 am
by oca
got it.
in sgf, the position "aa" means is left/top
like this :
$$Bc
$$ ----------------
$$ | X . . . . . .
$$ | . . . . . . .
$$ | . . . . . . .
$$ | . . . , . . .
$$ | . . . . . . .
$$ | . . . . . . .
$$ | . . . . . . .
- Click Here To Show Diagram Code
[go]$$Bc
$$ ----------------
$$ | X . . . . . .
$$ | . . . . . . .
$$ | . . . . . . .
$$ | . . . , . . .
$$ | . . . . . . .
$$ | . . . . . . .
$$ | . . . . . . .[/go]
So when the tsumego is in the bottom left corner the sgf coordonate is not the same on a 13x13 and on a 19x19, that's why changing the SZ property don't work...
$$Bc
$$ +---------------------------+
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . , . . , . . , . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . , . . , . . , . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . , . . , . . , . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | 1 . . . . . . . . . . . . |
$$ +---------------------------+
- Click Here To Show Diagram Code
[go]$$Bc
$$ +---------------------------+
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . , . . , . . , . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . , . . , . . , . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . , . . , . . , . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | 1 . . . . . . . . . . . . |
$$ +---------------------------+[/go]
on a 13x13,

is position "am"
$$Bc
$$ +---------------------------------------+
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . , . . . . . , . . . . . , . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . , . . . . . , . . . . . , . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | Y . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . , . . . . . , . . . . . , . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | 1 . . . . . . . . . . . . . . . . . . |
$$ +---------------------------------------+
- Click Here To Show Diagram Code
[go]$$Bc
$$ +---------------------------------------+
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . , . . . . . , . . . . . , . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . , . . . . . , . . . . . , . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | Y . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . , . . . . . , . . . . . , . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | 1 . . . . . . . . . . . . . . . . . . |
$$ +---------------------------------------+[/go]
on a 19x19,

is position "as", (and "am" leads to

)
I will now fix your files now. not sur I can keep the comments as the encoding seems to be a problem for my computer...
Code: Select all
C[¡¡¡¡Èçͼ1£¬ºÚÆåÐèÒª³Ôµô°×ÆåµÄÆå½î£¬ºÚ1ÊÇÕ÷³Ô£¬Ö®ºóºÚÆå²½²½½Ð³Ô£¬²¢ÇÒÇÉÃîµØ±Ü¹ý°×ÆåÍâΧµÄÆå×Ó£¬Õâ¸ö¹ý³Ì¾ÍÊÇÕ÷³Ô£¬ËäÈ»¹ý³ÌºÜ³¤£¬µ«²¢²»¸´ÔÓ¡£]
weird comment is it ;)
Re: How to transform bunch of 13x13 SGFs into 19x19
Posted: Thu Oct 23, 2014 12:15 pm
by kupus
many thanks.
comments are really not important as they are in chinese
Re: How to transform bunch of 13x13 SGFs into 19x19
Posted: Sat Oct 25, 2014 1:21 am
by oca
Here is the "groovy" script I used to fix the files, unfortunatly I had to remove the comments :
Code: Select all
new File($/F:\Tesuji Specialized Training (From Shodan to 3d) SGF - Copie/$).eachFileRecurse { f->
if (f.toString().endsWith(".sgf")) {
def content = f.getText();
def replaced = content
.replace("SZ[13]","SZ[19]")
.replaceAll(/C[^\]]*/,"C[")
.replaceAll(/\[[a-z]{2}\]/, { match ->
int positionToFix = match[2].charAt(0)
int fixedCoord = positionToFix + 6
def fixedLetter = ((char)fixedCoord)
match[0..1]+fixedLetter+"]"
} )
f.write(replaced)
}
}