How to transform bunch of 13x13 SGFs into 19x19

For discussing go computing, software announcements, etc.
Post Reply
kupus
Dies in gote
Posts: 45
Joined: Tue Jan 04, 2011 2:43 pm
GD Posts: 0
Has thanked: 12 times
Been thanked: 8 times

How to transform bunch of 13x13 SGFs into 19x19

Post 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
User avatar
EdLee
Honinbo
Posts: 8859
Joined: Sat Apr 24, 2010 6:49 pm
GD Posts: 312
Location: Santa Barbara, CA
Has thanked: 349 times
Been thanked: 2070 times

Post 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 :black: stones. )

Good luck.
User avatar
oca
Lives in gote
Posts: 699
Joined: Wed Feb 19, 2014 2:53 am
Rank: DDK
GD Posts: 0
KGS: aco
IGS: oca
OGS: oca
Location: Switzerland
Has thanked: 485 times
Been thanked: 166 times

Re: How to transform bunch of 13x13 SGFs into 19x19

Post 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 :
Click Here To Show Diagram Code
[go]$$Bc13 Black to kill
$$ ----------------+
$$ . . . . . . . . |
$$ . . . . . . . . |
$$ . . . . . X O . |
$$ . . . . , . X . |
$$ . . . . . . . . |
$$ . . . . . . . . |
$$ . , . . . . . . |[/go]
you will need to fix the moves too...
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
RobertJasiek
Judan
Posts: 6273
Joined: Tue Apr 27, 2010 8:54 pm
GD Posts: 0
Been thanked: 797 times
Contact:

Re: How to transform bunch of 13x13 SGFs into 19x19

Post 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.
kupus
Dies in gote
Posts: 45
Joined: Tue Jan 04, 2011 2:43 pm
GD Posts: 0
Has thanked: 12 times
Been thanked: 8 times

Re: How to transform bunch of 13x13 SGFs into 19x19

Post 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
User avatar
oca
Lives in gote
Posts: 699
Joined: Wed Feb 19, 2014 2:53 am
Rank: DDK
GD Posts: 0
KGS: aco
IGS: oca
OGS: oca
Location: Switzerland
Has thanked: 485 times
Been thanked: 166 times

Re: How to transform bunch of 13x13 SGFs into 19x19

Post 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.
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
kupus
Dies in gote
Posts: 45
Joined: Tue Jan 04, 2011 2:43 pm
GD Posts: 0
Has thanked: 12 times
Been thanked: 8 times

Re: How to transform bunch of 13x13 SGFs into 19x19

Post by kupus »

Thanks oca, just sent you a PM
User avatar
oca
Lives in gote
Posts: 699
Joined: Wed Feb 19, 2014 2:53 am
Rank: DDK
GD Posts: 0
KGS: aco
IGS: oca
OGS: oca
Location: Switzerland
Has thanked: 485 times
Been thanked: 166 times

Re: How to transform bunch of 13x13 SGFs into 19x19

Post by oca »

got it.

in sgf, the position "aa" means is left/top
like this :

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...
Click Here To Show Diagram Code
[go]$$Bc
$$ +---------------------------+
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . , . . , . . , . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . , . . , . . , . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . , . . , . . , . . . |
$$ | . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . |
$$ | 1 . . . . . . . . . . . . |
$$ +---------------------------+[/go]
on a 13x13, :b1: is position "am"

Click Here To Show Diagram Code
[go]$$Bc
$$ +---------------------------------------+
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . , . . . . . , . . . . . , . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . , . . . . . , . . . . . , . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | Y . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . , . . . . . , . . . . . , . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | 1 . . . . . . . . . . . . . . . . . . |
$$ +---------------------------------------+[/go]
on a 19x19, :b1: is position "as", (and "am" leads to :bt: )

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 ;)
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
kupus
Dies in gote
Posts: 45
Joined: Tue Jan 04, 2011 2:43 pm
GD Posts: 0
Has thanked: 12 times
Been thanked: 8 times

Re: How to transform bunch of 13x13 SGFs into 19x19

Post by kupus »

many thanks.

comments are really not important as they are in chinese
User avatar
oca
Lives in gote
Posts: 699
Joined: Wed Feb 19, 2014 2:53 am
Rank: DDK
GD Posts: 0
KGS: aco
IGS: oca
OGS: oca
Location: Switzerland
Has thanked: 485 times
Been thanked: 166 times

Re: How to transform bunch of 13x13 SGFs into 19x19

Post 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)
	}
}
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
Post Reply