It is currently Tue Apr 23, 2024 12:39 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
Offline
 Post subject: How to transform bunch of 13x13 SGFs into 19x19
Post #1 Posted: Tue Oct 21, 2014 8:32 pm 
Dies in gote

Posts: 45
Liked others: 12
Was liked: 8
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

Top
 Profile  
 
Offline
 Post subject:
Post #2 Posted: Tue Oct 21, 2014 9:05 pm 
Honinbo
User avatar

Posts: 8859
Location: Santa Barbara, CA
Liked others: 349
Was liked: 2076
GD Posts: 312
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.

Top
 Profile  
 
Offline
 Post subject: Re: How to transform bunch of 13x13 SGFs into 19x19
Post #3 Posted: Tue Oct 21, 2014 11:29 pm 
Lives in gote
User avatar

Posts: 699
Location: Switzerland
Liked others: 485
Was liked: 166
Rank: DDK
KGS: aco
IGS: oca
OGS: 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

Top
 Profile  
 
Offline
 Post subject: Re: How to transform bunch of 13x13 SGFs into 19x19
Post #4 Posted: Wed Oct 22, 2014 1:00 am 
Judan

Posts: 6155
Liked others: 0
Was liked: 788
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.

Top
 Profile  
 
Offline
 Post subject: Re: How to transform bunch of 13x13 SGFs into 19x19
Post #5 Posted: Wed Oct 22, 2014 11:19 am 
Dies in gote

Posts: 45
Liked others: 12
Was liked: 8
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

Top
 Profile  
 
Offline
 Post subject: Re: How to transform bunch of 13x13 SGFs into 19x19
Post #6 Posted: Wed Oct 22, 2014 1:46 pm 
Lives in gote
User avatar

Posts: 699
Location: Switzerland
Liked others: 485
Was liked: 166
Rank: DDK
KGS: aco
IGS: oca
OGS: 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

Top
 Profile  
 
Offline
 Post subject: Re: How to transform bunch of 13x13 SGFs into 19x19
Post #7 Posted: Thu Oct 23, 2014 11:12 am 
Dies in gote

Posts: 45
Liked others: 12
Was liked: 8
Thanks oca, just sent you a PM

Top
 Profile  
 
Offline
 Post subject: Re: How to transform bunch of 13x13 SGFs into 19x19
Post #8 Posted: Thu Oct 23, 2014 11:47 am 
Lives in gote
User avatar

Posts: 699
Location: Switzerland
Liked others: 485
Was liked: 166
Rank: DDK
KGS: aco
IGS: oca
OGS: 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:
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

Top
 Profile  
 
Offline
 Post subject: Re: How to transform bunch of 13x13 SGFs into 19x19
Post #9 Posted: Thu Oct 23, 2014 12:15 pm 
Dies in gote

Posts: 45
Liked others: 12
Was liked: 8
many thanks.

comments are really not important as they are in chinese

Top
 Profile  
 
Offline
 Post subject: Re: How to transform bunch of 13x13 SGFs into 19x19
Post #10 Posted: Sat Oct 25, 2014 1:21 am 
Lives in gote
User avatar

Posts: 699
Location: Switzerland
Liked others: 485
Was liked: 166
Rank: DDK
KGS: aco
IGS: oca
OGS: oca
Here is the "groovy" script I used to fix the files, unfortunatly I had to remove the comments :

Code:
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

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group