Page 1 of 2

Merging sgf problem files?

Posted: Sun Mar 30, 2014 8:37 am
by Aidoneus
I have used "cmd copy *.sgf new.prb" but the resulting file always contains multiple errors. Among the worst: color switching (confusing with directions in the text), sometimes two problems in the same board, and answers always marked wrong. Can someone please explain a "nice" way to merge hundreds of single problem sgfs into one file. It would be especially nice if the merged file allows various options, such as keeping track of right/wrong counts, randomization of problems (even more useful if it preferentially loads missed problems), rotating board orientation, and switching color (with a switch in text). Thanks in advance for any help!

Re: Merging sgf problem files?

Posted: Sun Mar 30, 2014 9:15 am
by DrStraw
Years ago I wrote a routine which merged multiple sgf files into a single one. It was designed to work with a folder full of games but I guess it would work with problems. I think if would merge up to ten levels deep. I have not looked at it for 10 years. I wrote it in Excel VBA so it needs Excel to run. It could be converted to some other language if you know how. I could try to find it if you think I may help.

Re: Merging sgf problem files?

Posted: Sun Mar 30, 2014 12:41 pm
by Aidoneus
I have an older version of Excel, though I mostly use the OpenOffice suite. Assuming that I can run your program under one or the other of my programs, I would be interested in trying, and very grateful to you for your consideration whatever the result.

Re: Merging sgf problem files?

Posted: Sun Mar 30, 2014 3:26 pm
by DrStraw
Send me a PM with an e-mail address and I'll mail it to you. I have to tell you though, that I have not looked at it for about 10 years (I found it and the file date was 2003) and make no claims with it. But if you can read VB you should be able to make sense of it.

Re: Merging sgf problem files?

Posted: Sun Mar 30, 2014 4:22 pm
by Aidoneus
OK, I sent you a PM (I think!). Thanks.

Re: Merging sgf problem files?

Posted: Sun Mar 30, 2014 6:55 pm
by leichtloeslich
and answers always marked wrong.

It would be especially nice if the merged file allows various options, such as keeping track of right/wrong counts,

Don't get me wrong, but this sounds like you're confusing features of your specific sgf-editor (probably some sort of problem-solver thingy) with the sgf-format in general.
What sgf-editor are you using?

From what I read about sgf, just concatenating all sgf-files into a single file should work. I tried it with about 900 problem files I have, and it worked.
However, the only sgf-editor that correctly displayed the resulting collection-sgf was jago (gopanda had a buggy output, cgoban 3 simply ignored all but the first problem and gogui informed me that it simply doesn't support multiple sgf trees).


Either way, if certain sgf-editors have problems with game collections, maybe it's not a good idea to use them in the first place.

Re: Merging sgf problem files?

Posted: Sun Mar 30, 2014 11:15 pm
by dfunkt

Re: Merging sgf problem files?

Posted: Mon Mar 31, 2014 6:33 am
by Aidoneus
leichtloeslich: I downloaded Jago. It would only open the first problem from my merged file. Perhaps it is because of the way that I merged it. However, Many Faces of Go v12 does open the file, though with the issues I listed in my original post. BTW, David Fotland (author of MFG) suggested the cmd string to merge the files, though he said that he hadn't tried it. How did you concatenate the various problem files?

dfunkt: I found that program before asking here. Since there is no instruction at the site for using it in Windows, and I don't know anything about Java, I have no idea how to use it.

DrStraw: Thank you for your help, but I am afraid that if I have to learn Excel VBA to reprogram a macro, I will never get it to work for me. At least not without way too much hand holding. I apologize for wasting your time.

I have to say, though, that I am surprised that I haven't found any Go database program that can do what I ask. Does anyone know of a Go program that is comparable to ChessBase? ChessBase wasn't free, and I would pay for a good Go database program. I want to spend my free time learning Go, not learning to program!

Re: Merging sgf problem files?

Posted: Mon Mar 31, 2014 7:00 am
by oca
Aidoneus wrote:I have used "cmd copy *.sgf new.prb"


Did that command work better ?

Code: Select all

cmd copy /B *.sgf new.prb


If that don't work, I may look into the file to see if I can find something that may cause the problem.
but you will then need to send me the full sgf file so that I can look inside...

Re: Merging sgf problem files?

Posted: Mon Mar 31, 2014 7:42 am
by Aidoneus
oca: I tried your modified cmd string. Same trouble. I purchased GoGoD and membership at GoBase.org for problems, but I have also downloaded free problems from other sites, such as http://www.u-go.net/classic/. For example, after expanding qjzm.zip from the latter site, I had several hundred sgf problem files. Running either cmd copy variant produced one file, but with reversed colors. Although your cmd string seemed to reverse colors with just every other problem.

BTW, the problems included with MFG--Graded Go Problems for Beginners v 1--are located in just one file and work perfectly.

Re: Merging sgf problem files?

Posted: Mon Mar 31, 2014 8:04 am
by Aidoneus
oca: After looking at a few more problems in the merged file, it became clear that the file was broken--that is, I could not even input a solution or move forward through the stored solution, only step to the next problem, which again could not be solved.

Please let me know if the merged file works correctly with some other program than MFG.

Re: Merging sgf problem files?

Posted: Mon Mar 31, 2014 9:02 am
by leichtloeslich
I downloaded Jago. It would only open the first problem from my merged file.

Have you tried "Next game" in the "Nodes" menu?

How did you concatenate the various problem files?

Code: Select all

$ cat *.sgf > collection.sgf

That's how to concatenate files under linux. Under windows you do it via the "copy" command, as others have pointed out.


I have to say, though, that I am surprised that I haven't found any Go database program that can do what I ask. Does anyone know of a Go program that is comparable to ChessBase?

Not sure what Chessbase can do, but maybe check out Drago and GoGrinder.

Re: Merging sgf problem files?

Posted: Mon Mar 31, 2014 10:55 am
by oca
Aidoneus wrote: reversed colors

This is not a bug, this is a feature ;)

Many Faces of Go treats .prb files differently than .sgf files, with .prb file, there is a "problems" menu where there is an option "Random Orientation/Color".

Re: Merging sgf problem files?

Posted: Mon Mar 31, 2014 12:50 pm
by Aidoneus
leichtloeslich: Yes, I would have tried next game except it was grayed out. And yes, I used the copy cmd to create a new prb file. I will take a look at GoGrinder, thank you.

oca: Yes, Random Orientation/Color is a nice feature in MFG, especially as it works with the included Graded Go Problems for Beginners v1. It does not work properly with any of my merged files.
First, each merged file will not open in MFG with Open/View/Edit Game or Solve Go Problems under File; they will open with Edit File of Go Problems under File. Second, for most problems the text directions (say, Black to move) and move side are reversed (White to move)--by itself a minor issue. Third, occasionally problems are run together on the board. Fourth, and this is the main issue, because the solutions are not reversed along with the colors, every problem answer will be marked wrong after the first correct move and no further moves can be made in a sequence--the full sequence will appear, however, but only by stepping through the stored solution.
If you still want to help, would you try merging the sgf files in qjzm.zip (a mere 17 kilobyte download) and see if you can get a single file that works properly--in MFG or any other program? And explain how I could replicate your result without having to learn a programming language? I can't afford to pull much more hair out! :lol:

Re: Merging sgf problem files?

Posted: Mon Mar 31, 2014 1:23 pm
by Aidoneus
leichtloeslich: GoGrinder looks like it might be the go database program I have been looking for. At least if I can figure out why it will load the default single sgf files in one folder, but not (yet!) a folder with my single sgf files. If I could get this to work, I wouldn't need to merge the sgf files. I suppose that I need to read the documentation before asking any more questions...